当前位置:网站首页>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
边栏推荐
- ViT论文详解
- [Yu Yue education] higher mathematics of Nanchang University (2) reference materials
- Five wars of Chinese Baijiu
- Checkpoint of RDD in spark
- Leetcode topic [array] -118 Yang Hui triangle
- [asp.net core] set the format of Web API response data -- formatfilter feature
- It's not my boast. You haven't used this fairy idea plug-in!
- Uni app app half screen continuous code scanning
- What about the spectrogram
- Kohana database
猜你喜欢

AI 企业多云存储架构实践 | 深势科技分享

GPS from entry to abandonment (XVII), tropospheric delay

The golden age of the U.S. technology industry has ended, and there have been constant lamentations about chip sales and 30000 layoffs

Sequoia China, just raised $9billion

抖音将推独立种草App“可颂”,字节忘不掉小红书?

ViT论文详解
![Happy sound 2[sing.2]](/img/ca/1581e561c427cb5b9bd5ae2604b993.jpg)
Happy sound 2[sing.2]

PostgreSQL install GIS plug-in create extension PostGIS_ topology

小满网络模型&http1-http2 &浏览器缓存

Method return value considerations
随机推荐
ROS error: could not find a package configuration file provided by "move_base“
The underlying implementation of string
[go][reprint]vscode run a HelloWorld example after configuring go
GPS from getting started to giving up (XVIII), multipath effect
C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
Hill | insert sort
[daily] win10 system setting computer never sleeps
Reptile practice (V): climbing watercress top250
保存和检索字符串
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
High precision face recognition based on insightface, which can directly benchmark hongruan
LeetCode:1189. The maximum number of "balloons" -- simple
Save and retrieve strings
GPS from entry to abandonment (XVII), tropospheric delay
50 commonly used numpy function explanations, parameters and usage examples
关于char[]数组通过scanf赋值使用上的一些问题。。
guava:创建immutableXxx对象的3种方式
Is it important to build the SEO foundation of the new website
GPS從入門到放弃(十三)、接收機自主完好性監測(RAIM)
Earned value management EVM detailed explanation and application, example explanation