OpenJudge1.6答案
01:与指定数字相同的数的个数
#include <stdio.h>
#include <math.h>
#include <stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[])
{int n,medium,m[100],i=1,count=0;scanf("%d",&n);while(i<=n){scanf("%d",&m[i]);i++;}i=1;scanf("%d",&medium);while(i<=n){if(m[i]==medium){count++;}i++;}printf("%d",count);
}
02:陶陶摘苹果
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char** argv) {int a,h[11],i=1,count=0,high;while(i<=10){scanf("%d",&h[i]);++i;}scanf("%d",&high);for(i=1;i<=10;++i){if(high+30>=h[i]){++count;}}printf("%d",count);return 0;
}
03:计算书费
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;int main(int argc, char *argv[])
{int num[11],i=1;float sum=0;while(i<=10){scanf("%d",&num[i]);i++;}i=1;switch(i){case 1:sum+=num[i]*28.9;i++;case 2:sum+=num[i]*32.7;i++;case 3:sum+=num[i]*45.6;i++;case 4:sum+=num[i]*78.0;i++;case 5:sum+=num[i]*35.0;i++;case 6:sum+=num[i]*86.2;i++;case 7:sum+=num[i]*27.8;i++;case 8:sum+=num[i]*43.0;i++;case 9:sum+=num[i]*56.0;i++;case 10:sum+=num[i]*65.0;i++;break;}printf("%.1f",sum);
}
04:数组逆序重放
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char** argv) {int a[100],n,i=1;scanf("%d",&n);while(i<=n){scanf("%d",&a[i]);++i;}for(i=n;i>=1;--i){cout<<a[i]<<" "; } return 0;
}
05:年龄与疾病
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <iomanip>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char** argv) {int n,age[101],i=1,count[5],sum;float average;count[1]=count[2]=count[3]=count[4]=0;scanf("%d",&n);while(i<=n){scanf("%d",&age[i]);if(age[i]>=-1&&age[i]<=18){count[1]++;}else if(age[i]>=19&&age[i]<=35){count[2]++; } else if(age[i]>=36&&age[i]<=60){count[3]++;}else{count[4]++;}i++;}sum=(count[1]+count[2]+count[3]+count[4]);for(i=1;i<=4;i++){average=count[i]*1.0/n*100;printf("%.2f%%\n",average);
}return 0;
}
06:校门外的树
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char** argv) {int a[10001]={0},i=1,l,m,count=0,start,end,j;cin>>l>>m;for(int i=0;i<m;i++){cin>>start>>end;for(int j=start;j<=end;j++)a[j]=1; }for(int i=0;i<=l;i++)if(a[i]==0)count++;cout<<count;return 0;
}
OpenJudge1.6答案相关推荐
- Openjudge1.3答案
Openjudge1.3答案 01 #include<stdio.h> #include<math.h> int main() {int a,b,c;scanf("% ...
- Openjudge1.4答案
Openjudge1.4答案 01 #include <stdio.h> int main() {long a;scanf("%ld",&a);if(a==0) ...
- OpenJudge1.3 答案
01:A+B问题 #include <stdio.h> #include <stdlib.h>/* run this program using the console pau ...
- [转]信息安全相关理论题(三)
21.静态分析是运行程序后进行调试? A. 对 B. 错 您的答案: 标准答案: B 22.安卓反编译后会出现$符号字节码表示是匿名内部类? A. 对 B. 错 您的答案: 标准答案: A 23.反编 ...
- openJudge1.4题库1~5题答案答案
这里是c++的地盘,c语言的什么东西我不知道,反正我写的代码都是c++的,呵呵.. 第一题 给定一个整数N,判断其正负. 这玩意儿太简单了,我就不多说了,直接上代码 #include<bits/ ...
- openjudge1.1所有答案
网址 OpenJudge - OpenJudge - 题目http://noi.openjudge.cn/ch0101/ 01:Hello, World! 描述 对于大部分编程语言来说,编写一个能够输 ...
- 华东理工大学计算机应用基础,最新华东理工大学计算机应用基础网上作业及全部答案...
精品文档 华东理工大学计算机应用基础网上作业及全部答案 2012计算机应用基础答案: 一.选择题 1.文件夹是用来对应用程序.文件进行分组的,以下说法中()正确.答:一个文件夹内可以包含文件.应用程序 ...
- 山西农业大学c语言答案,第一章C语言及程序设计概述-东北农业大学教务处.doc...
全国高等农林院校"十一五"规划教材 C语言程序设计 孙力 主编 中国农业出版社 内容简介 本书是全国高等农林院校"十一五"规划教材之一. 全书共11章,分别介绍 ...
- 2016计算机二级java_2016计算机二级JAVA练习题及答案
2016计算机二级JAVA练习题及答案 21.下列选项中,不能输出100个整数的.是( ). A.for(int i=0;i<100;i++) System.out.println(i); B. ...
最新文章
- problem h: 一年中的第几天_一年级语文26个汉语拼音字母表读法+写法+笔顺,给孩子收藏!...
- DELL本本 执行SQL语句要FN+F5 如何更改成F5
- 2018批量打印开关_新品上市,震撼来袭!买UV平板打印机,一定看过这款后再定!...
- activeMQ的三种通讯模式
- 解决:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) ...
- Handle/Body pattern(Wrapper pattern)
- 给老板做PPT必备:文字加拼音
- ListView.setAdapter(adapter);空指针异常的解决的总结
- 查看数据库文件大小写
- 一个基于Spring Boot+Vue+Redis的物联网智能家居系统,可二次开发接私活!
- 基于 Google 搜索的半自动推荐
- 漏洞分析检测的主要技术
- iNFTnews|Web3走进FIFA世界杯
- ICX285 ICX205 ICX414 3CCD共用驱动板电路设计
- Git stash 指令总结:暂存和恢复
- 学习游戏原画需要什么条件或者基础吗?
- H5 六边形消除游戏开发 1
- 2021-01 补丁日: 微软多个高危漏洞通告
- (三十七)期权的隐含波动率计算与图形
- LeetCode 217、219. 存在重复元素