您的位置:首页 > 其它

UVALive 4853 Emoogle Balance

2015-10-04 20:10 375 查看
题意:题目很长,其实主要就是题中加粗的那个公式和输入输出。给n个数,用非零数的个数减去零的个数。

水题啦~

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a[1005];

int main()
{
int ans, cnt = 1, n;
while(~scanf("%d", &n))
{
ans = 0;
if(n == 0)
break;
int b;
for(int i = 0; i < n; i++)
{
scanf("%d", &b);
if(b == 0)
ans--;
else
ans++;
}
printf("Case %d: %d\n", cnt++, ans);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: