当前位置:网站首页>HDU 2008 digital statistics
HDU 2008 digital statistics
2022-07-06 21:58:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
Number value statistics
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 53462 Accepted Submission(s): 27366
Problem Description
Statistics given n In number , negative 、 Number of zero and positive numbers .
Input
Multiple groups of input data , One row for each group , The first number in each row is an integer n(n<100), Indicates the number of values to be counted , And then there was n A real number ; hypothesis n=0, Indicates the end of input , This line does not process .
Output
Input data for each group . Output one line a,b and c. Respectively represent the negative numbers in the given data 、 Number of zero and positive numbers .
Sample Input
6 0 1 2 3 -1 0
5 1 2 3 4 0.5
0 Sample Output
1 2 3
0 0 5Be careful : You cannot save data in an array , Because the number entered may be decimal . We need to infer one by one
#include<stdio.h>
int main()
{
int n;
while(scanf("%d",&n),n)
{
int i,j,a=0,b=0,c=0;
double s;
for(i=0;i<n;i++)
{
scanf("%lf",&s);
{
if(s<0) a++;
else if(s==0) b++;
else if(s>0) c++;
}
}
printf("%d %d %d",a,b,c);
printf("\n");
}
return 0;
}Copyright notice : This article is the original article of the blogger , Blog , Do not reprint without permission .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117039.html Link to the original text :https://javaforall.cn
边栏推荐
- Why is the cluster mode of spark on Yan better than the client mode
- Happy sound 2[sing.2]
- What about the spectrogram
- Run the deep network on PI and Jetson nano, and the program is killed
- GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
- 关于程序员的职业操守,从《匠艺整洁之道》谈起
- 14 years Bachelor degree, transferred to software testing, salary 13.5k
- Reptile practice (V): climbing watercress top250
- From campus to Tencent work for a year of those stumbles!
- What is the difference between animators and animators- What is the difference between an Animator and an Animation?
猜你喜欢

C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events

Reptile practice (V): climbing watercress top250

Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?

Numpy download and installation

uni-app App端半屏连续扫码

红杉中国,刚刚募资90亿美元

Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic

【sciter】: 基于 sciter 封装通知栏组件

Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?

麦趣尔砸了小众奶招牌
随机推荐
Comparison between multithreaded CAS and synchronized
Why is the cluster mode of spark on Yan better than the client mode
抖音将推独立种草App“可颂”,字节忘不掉小红书?
Depth first traversal (DFS) and breadth first traversal (BFS)
uni-app App端半屏连续扫码
It's not my boast. You haven't used this fairy idea plug-in!
Explain ESM module and commonjs module in simple terms
Reset Mikrotik Routeros using netinstall
Uni app app half screen continuous code scanning
MariaDb数据库管理系统的学习(一)安装示意图
Leveldb source code analysis series - main process
From campus to Tencent work for a year of those stumbles!
Persistence / caching of RDD in spark
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
make menuconfig出现recipe for target ‘menuconfig‘ failed错误
[asp.net core] set the format of Web API response data -- formatfilter feature
GPS from getting started to giving up (XX), antenna offset
C语言:#if、#def和#ifndef综合应用
Happy sound 2[sing.2]