当前位置:网站首页>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
边栏推荐
- Realization of epoll reactor model
- GPS from entry to abandonment (XVII), tropospheric delay
- Run the deep network on PI and Jetson nano, and the program is killed
- OpenCV300 CMake生成project在项目过程中的问题
- [daily] win10 system setting computer never sleeps
- From campus to Tencent work for a year of those stumbles!
- numpy 下载安装
- 【sciter Bug篇】多行隐藏
- Redistemplate common collection instructions opsforlist (III)
- What can one line of code do?
猜你喜欢
随机推荐
GPS从入门到放弃(十四)、电离层延时
红杉中国,刚刚募资90亿美元
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
uni-app App端半屏连续扫码
Make menuconfig has a recipe for target 'menuconfig' failed error
Vit paper details
GPS from getting started to giving up (XIII), receiver autonomous integrity monitoring (RAIM)
Solution to the problem of UOS boot prompt unlocking login password ring
1292_ Implementation analysis of vtask resume() and xtask resume fromisr() in freeros
Numpy download and installation
Earned value management EVM detailed explanation and application, example explanation
[Yu Yue education] reference materials for surgical skills teaching in Tongji University
十一、服务介绍及端口
[go][reprint]vscode run a HelloWorld example after configuring go
GPS from getting started to giving up (XV), DCB differential code deviation
功能强大的国产Api管理工具
[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation
Guava: use of multiset
Write a rotation verification code annotation gadget with aardio
Sdl2 source analysis 7: performance (sdl_renderpresent())









