当前位置:网站首页>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
边栏推荐
- PostgreSQL install GIS plug-in create extension PostGIS_ topology
- Uni app app half screen continuous code scanning
- Unity3D学习笔记6——GPU实例化(1)
- Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
- Kohana database
- Huawei has launched attacks in many industries at the same time, and its frightening technology has made European and American enterprises tremble
- Reset Mikrotik Routeros using netinstall
- [go][reprint]vscode run a HelloWorld example after configuring go
- 在Pi和Jetson nano上运行深度网络,程序被Killed
- Earned value management EVM detailed explanation and application, example explanation
猜你喜欢
GPS from getting started to giving up (19), precise ephemeris (SP3 format)
[Yu Yue education] higher mathematics of Nanchang University (2) reference materials
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
guava:Collections. The collection created by unmodifiablexxx is not immutable
Earned value management EVM detailed explanation and application, example explanation
Write a rotation verification code annotation gadget with aardio
C# 如何在dataGridView里设置两个列comboboxcolumn绑定级联事件的一个二级联动效果
Z function (extended KMP)
GPS from getting started to giving up (XV), DCB differential code deviation
中国白酒的5场大战
随机推荐
GPS from entry to abandonment (XVII), tropospheric delay
MPLS experiment
Run the deep network on PI and Jetson nano, and the program is killed
Guava: three ways to create immutablexxx objects
经纪xx系统节点VIP案例介绍和深入分析异常
Oracle Performance Analysis 3: introduction to tkprof
Set status bar style demo
MySQL related terms
GPS从入门到放弃(十九)、精密星历(sp3格式)
Oracle性能分析3:TKPROF简介
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
guava:Collections. The collection created by unmodifiablexxx is not immutable
强化学习-学习笔记5 | AlphaGo
Five wars of Chinese Baijiu
Why is the cluster mode of spark on Yan better than the client mode
C language: comprehensive application of if, def and ifndef
14 years Bachelor degree, transferred to software testing, salary 13.5k
Depth first traversal (DFS) and breadth first traversal (BFS)
Write a rotation verification code annotation gadget with aardio
From campus to Tencent work for a year of those stumbles!