IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 开发测试 -> 每日算法 day1 -> 正文阅读

[开发测试]每日算法 day1

1559A - Mocha and Math

#include<stdio.h>
int main(){
	int n,k,arr[100],t;
	scanf("%d",&n);
	while(n--){
		scanf("%d",&k);
		scanf("%d",&arr[0]);
		t=arr[0];
		for(int i=1;i<k;i++){
			scanf("%d",&arr[i]);
			t=t&arr[i];		
		}
		printf("%d\n",t);
		}
 
    return 0;
}

每个case可以无数次位操作,那么穷尽所有可进行的位运算后,数列中的每一个数都是一样的大小,且是原数列所有数一起做&运算的结果
每做一次&运算,只可能变小或不变,不可能变大,所有穷尽运算必然最小

112A

#include<stdio.h>
#include<string.h>
int main(){
	//A 65   Z 90    a 97   z 122
	int s1=0,s2=0,n;
	char a[100],b[100];
	
	scanf("%s",a);
	scanf("%s",b);
	n=strlen(a);
	for(int i=0;i<n;i++){
		
		int kk=(int)a[i] ;
		if(kk>95){
			s1+=kk-96;
		}
		else{
			s1+=kk-64;
		}
		
		kk=(int)b[i];
		if(kk>95){
			s2+=kk-96;
		}
		else{
			s2+=kk-64;
		}
	}
	if(s1<=s2){
		if(s1==s2){
			printf("%d\n",0);
		}
		else{
			printf("%d\n",-1);
		}
	}
	else{
		printf("%d\n",1);
	}

    return 0;
}

第五个测试点出错
测试点:
Test: #5, time: 0 ms., memory: 3612 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER
Input
aslkjlkasdd
asdlkjdajwi
Output
0
Answer
1
Checker Log
wrong answer expected 1, found 0

200B B. Drinks

Little Vasya loves orange juice very much. That’s why any food and
drink in his kitchen necessarily contains orange juice. There are n
drinks in his fridge, the volume fraction of orange juice in the i-th
drink equals pi percent.

One day Vasya decided to make himself an orange cocktail. He took
equal proportions of each of the n drinks and mixed them. Then he
wondered, how much orange juice the cocktail has.

Find the volume fraction of orange juice in the final drink.

Input The first input line contains a single integer n (1?≤?n?≤?100) —
the number of orange-containing drinks in Vasya’s fridge. The second
line contains n integers pi (0?≤?pi?≤?100) — the volume fraction of
orange juice in the i-th drink, in percent. The numbers are separated
by a space.

Output Print the volume fraction in percent of orange juice in Vasya’s
cocktail. The answer will be considered correct if the absolute or
relative error does not exceed 10??-?4.

Examples
input:
3 50 50 100
output:
66.666666666667

#include<stdio.h>
 
int main(){
      int n,sum,t;
      scanf("%d",&n);
      for(int i=0;i<n;i++){  
            scanf("%d",&t);
            sum+=t;
      }
      
      printf("%f",(double)sum/(double)n);
	return 0;
      
      
}

原来进行输出采用的占字符时%lf,发现一直输出为0.000,
百度发现,%lf是double专属,%f是double、float混用的,并且c11不提供隐式类型转换,都要手动555555555555

  开发测试 最新文章
pytest系列——allure之生成测试报告(Wind
某大厂软件测试岗一面笔试题+二面问答题面试
iperf 学习笔记
关于Python中使用selenium八大定位方法
【软件测试】为什么提升不了?8年测试总结再
软件测试复习
PHP笔记-Smarty模板引擎的使用
C++Test使用入门
【Java】单元测试
Net core 3.x 获取客户端地址
上一篇文章      下一篇文章      查看所有文章
加:2021-08-27 12:10:10  更:2021-08-27 12:11:27 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/13 12:34:10-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码