#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:整数的个数的更多相关文章

  1. 计算概论(A)/基础编程练习2(8题)/8:1的个数

    #include<stdio.h> int main() { ; // 存储测试数据的二进制形式中1的个数 int bian[N]; // 输入十进制整数N 表示N行测试数据 scanf( ...

  2. 计算概论(A)/基础编程练习2(8题)/6:数组逆序重放

    #include<stdio.h> int main() { // 输入n个整数 ; scanf("%d", &n); // 循环读入元素 while(scan ...

  3. 计算概论(A)/基础编程练习2(8题)/5:点和正方形的关系

    #include<stdio.h> #include<math.h> int main() { // 输入坐标 float x, y; while(scanf("%f ...

  4. 计算概论(A)/基础编程练习1(8题)/2:苹果和虫子

    #include<stdio.h> #include<math.h> int main() { /* n个苹果 每x小时能吃掉一个苹果 经过y小时 */ float n, x, ...

  5. 计算概论(A)/基础编程练习1(8题)/1:大象喝水

    #include<stdio.h> int main() { ; // n < 100 scanf("%d", &n); // 循环遍历判断 再进行平方和 ...

  6. 计算概论(A)/基础编程练习2(8题)/4:骑车与走路

    #include<stdio.h> int main() { // 待处理的数据数量n ; scanf("%d", &n); float meters[n]; ...

  7. 计算概论(A)/基础编程练习2(8题)/3:计算三角形面积

    #include<stdio.h> #include<math.h> int main() { // 声明三角形的三个顶点坐标和面积 float x1, y1, x2, y2, ...

  8. 计算概论(A)/基础编程练习2(8题)/2:计算书费

    #include<stdio.h> int main() { // 声明与初始化 ; // k组测试数据的总费用 double s[k]; // 单价表 double price[]= { ...

  9. 计算概论(A)/基础编程练习2(8题)/1:求平均年龄

    #include<stdio.h> int main() { // 声明与初始化 , s=, age=; // 输入学生人数 scanf("%d", &n); ...

随机推荐

  1. 实例讲解TP5中关联模型

    https://blog.csdn.net/github_37512301/article/details/75675054 一.关联模型在关系型数据库中,表之间有一对一.一对多.多对多的关系.在 T ...

  2. keycloak

    keycloak报错, 少了配置项   keycloak.enabled=ture 找不到 publicKey,  1   ping不通 认证中心,2 网络不好

  3. (转)从拜占庭将军问题谈谈为什么pow是目前最好的共识机制

    我们知道基于区块链技术现在有很多的共识机制,包括不限于POW,POS,DPOS,PBFT……,我先不说为什么我最认可POW,我们先来看看著名的拜占庭将军问题: 拜占庭帝国即中世纪的土耳其,拥有巨大的财 ...

  4. 【LeetCode每天一题】Substring with Concatenation of All Words(具备列表中所有单词的字串)

    You are given a string, s, and a list of words, words, that are all of the same length. Find all sta ...

  5. 小a和uim之大逃离

    题目传送门 #include <bits/stdc++.h> using namespace std; #define ll long long #define re register # ...

  6. iOS库

    https://medium.com/app-coder-io/33-ios-open-source-libraries-that-will-dominate-2017-4762cf3ce449#.i ...

  7. react 嵌套组件的通信

    在react中经常会用到的组件嵌套,如下: 图中 parent本身是一个自定义的组件,然后内部又加入了 child的自定义组件,那么这种情况,父子之间如何通信 react中在父组件里面有一个 this ...

  8. vue中使用hotcss--stylus

    页面中一直闪动这个. 后面改成scss后还是这样.还不知道原因

  9. cocos2d-x C++ (利用定时器自定义屏幕双击事件函数)

    //GameScene.h #include "cocos2d.h" USING_NS_CC; class GameScene : public cocos2d::Layer { ...

  10. python 定义函数 调用函数

    创建test.py文件 #coding=utf-8 #定义函数 def hello(): print "hello world" #调用函数 hello() 在cmd下面运行