当前位置:网站首页>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 5
Be 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
边栏推荐
- GPS from getting started to giving up (XVIII), multipath effect
- Sparkshuffle process and Mr shuffle process
- 11、 Service introduction and port
- GPS from entry to abandonment (XVII), tropospheric delay
- MySQL - transaction details
- 【MySQL】Online DDL详解
- PostgreSQL install GIS plug-in create extension PostGIS_ topology
- GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
- 红杉中国,刚刚募资90亿美元
- 十一、服务介绍及端口
猜你喜欢
随机推荐
Codeforces Round #274 (Div. 2) –A Expression
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
美国科技行业结束黄金时代,芯片求售、裁员3万等哀声不断
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
Aggregate function with key in spark
50 commonly used numpy function explanations, parameters and usage examples
GPS from getting started to giving up (XVIII), multipath effect
关于程序员的职业操守,从《匠艺整洁之道》谈起
Reset Mikrotik Routeros using netinstall
npm run dev启动项目报错 document is not defined
Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
GPS从入门到放弃(二十)、天线偏移
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
Guava: use of multiset
Redistemplate common collection instructions opsforzset (VI)
记一次清理挖矿病毒的过程
ROS error: could not find a package configuration file provided by "move_base“
保存和检索字符串
Uni app app half screen continuous code scanning
Realization of epoll reactor model