计算概论(A)/基础编程练习2(8题)/7:整数的个数
#include<stdio.h>
int main() {
int k,temp,n[] = {}; // 输入k个正整数
scanf("%d",&k); // 循环读入和进行算术
while(scanf("%d",&temp)!=EOF) {
switch(temp) {
case :
n[]++;
break;
case :
n[]++;
break;
case :
n[]++;
break;
}
} // 输出三行
for(int i=; i<; i++) {
printf("%d\n",n[i]);
}
// 运行中 Ctrl+z+回车 即可退出 Openjudge允许
return ;
}
/*
pkuic_1678.c
计算概论(A)/基础编程练习2(8题)/7:整数的个数
http://pkuic.openjudge.cn/base2/7/
7:整数的个数
查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 65536kB
描述
给定k(1 < k < 100)个正整数,其中每个数都是大于等于1,小于等于10的数。写程序计算给定的k个正整数中,1,5和10出现的次数。
输入
输入有两行:第一行包含一个正整数k,第二行包含k个正整数,每两个正整数用一个空格分开。
输出
输出有三行,第一行为1出现的次数,,第二行为5出现的次数,第三行为10出现的次数。
样例输入
5
1 5 8 10 5
样例输出
1
2
1
来源
计算概论05-模拟考试1
*/
计算概论(A)/基础编程练习2(8题)/7:整数的个数的更多相关文章
- 计算概论(A)/基础编程练习2(8题)/8:1的个数
#include<stdio.h> int main() { ; // 存储测试数据的二进制形式中1的个数 int bian[N]; // 输入十进制整数N 表示N行测试数据 scanf( ...
- 计算概论(A)/基础编程练习2(8题)/6:数组逆序重放
#include<stdio.h> int main() { // 输入n个整数 ; scanf("%d", &n); // 循环读入元素 while(scan ...
- 计算概论(A)/基础编程练习2(8题)/5:点和正方形的关系
#include<stdio.h> #include<math.h> int main() { // 输入坐标 float x, y; while(scanf("%f ...
- 计算概论(A)/基础编程练习1(8题)/2:苹果和虫子
#include<stdio.h> #include<math.h> int main() { /* n个苹果 每x小时能吃掉一个苹果 经过y小时 */ float n, x, ...
- 计算概论(A)/基础编程练习1(8题)/1:大象喝水
#include<stdio.h> int main() { ; // n < 100 scanf("%d", &n); // 循环遍历判断 再进行平方和 ...
- 计算概论(A)/基础编程练习2(8题)/4:骑车与走路
#include<stdio.h> int main() { // 待处理的数据数量n ; scanf("%d", &n); float meters[n]; ...
- 计算概论(A)/基础编程练习2(8题)/3:计算三角形面积
#include<stdio.h> #include<math.h> int main() { // 声明三角形的三个顶点坐标和面积 float x1, y1, x2, y2, ...
- 计算概论(A)/基础编程练习2(8题)/2:计算书费
#include<stdio.h> int main() { // 声明与初始化 ; // k组测试数据的总费用 double s[k]; // 单价表 double price[]= { ...
- 计算概论(A)/基础编程练习2(8题)/1:求平均年龄
#include<stdio.h> int main() { // 声明与初始化 , s=, age=; // 输入学生人数 scanf("%d", &n); ...
随机推荐
- Py中re.sub学习【转载】
转自:https://www.crifan.com/python_re_sub_detailed_introduction/ //这个网址讲的不错. 1.re.sub的功能 re是regular ex ...
- 23-Python3 File
''' file(文件)方法 ''' #open()对象 pass #file对象 ##file.close():关闭文件,关闭后不能再进行读写操作 fo1 = open('/Users/ligaij ...
- [Java] public, private, final and basic rules for naming.
1. Access: public, private, protected public: Any other class can access a public field or method. ( ...
- SpringMVC项目模块浅析
本文为个人笔记,对于springmvc模块的规划,仁者见仁.智者见智,请不要生搬硬套. 一.基础模块-basic 主要内容是dao.spring-xml.domain.service等内容,模块内分层 ...
- cocos2d-x c++ (多种屏幕Android与iOS的适配原理)
1.AppDelegate.cpp 文件中 bool AppDelegate::applicationDidFinishLaunching() { // initialize director aut ...
- JS怎么控制input框的背景颜色
$("input").css("background-color","red"); 参考:https://zhidao.baidu.com/ ...
- MYSQL 5.7修改密码,登录问题
mysql5.7 关于密码问题 报错: ERROR 1862 (HY000): Your password has expired. To log in you must change it usin ...
- Koa中设置中文Cookie值
默认情况下, 如果 ctx.cookies.set('user', '杨过', { domain: 'xxxx', path: 'xxxx', maxAge: 24 * 60 * 60 * 1000, ...
- Docker下操作指令
Docker下操作指令 以mysql为例 1.搜索镜像: #docker search mysql 2.拉取镜像 #docker pull mysql:5.7 3.加载镜像并绑定端口: #docker ...
- MYSQLi数据访问查询数据
单条件查询 <body> <div align="center" style="width:90%;"> <h1>数据查询& ...