We have a very famous and popular fellow in our problemsetters’ panel. He is so famous that his name is immaterial. Some of his admirers have recently given him the nickname ’Emoogle’. Let’s stick to that name in our discussion for now. Being such a kind, friendly and generous person as he is, Emoogle is often known to give treats to the other problemsetters. Some times, there is a strange rumor in the air that his treats are mostly due to the fact that, if he is not sparing enough for those treats, ’problems’ are likely to be created. But let’s not pay heed to such nonsense!
    Now, there is another word in the air that this remarkable man is going to get married soon. To observe this special occasion with proper respect, his fellow troublemakers have decided to compile a book named ’99 reasons why Emoogle should give us a treat’. Every single reason mentioned in this book is denoted by a number. For example, Emoogle should give us a treat because

  1. If he does not, problems will be created. ?
  2. His giveaway problem has been solved by less than 10 teams in the recent programming contest.
  3. He is going to join a world famous goggles manufacturing company soon.
  4. He has found a ticket of a soccer world cup game while digging his backyard garden in the morning.
  5. He has just got a new Facebook fan club.
  6. Having forgotten about a date with his wife-to-be which collided with a Topcoder SRM (Single Round Match), he participated in the SRM. (May God bless his soul!)
  7. A programming contest (may be this one?) is being arranged celebrating his marriage.
  8. He is getting engaged soon.
  9. Solely because he is the great and kind and sweet Emoogle.

If you have any more ideas about why he should throw a party, we would love to know. Drop us a line at emoogle.party gmail.com.
    At this point, Dear brother Emoogle might want to remind us about the number of times he has already thrown a party. Hence we introduce the term Emoogle Balance. This is defined as:
Emoogle Balance = number of times Emoogle is supposed to give a treat according to the book - number of times he has actually given the treat.
    In this problem, we want you to find Emoogle Balance. We also wish that Emoogle Balance always keeps a healthy negative value and may dear brother Emoogle have a very happy married life forever.
Input
There are around 75 test cases in the input file. Each test case describes a series of events. A test case starts with an integer N (1 ≤ N ≤ 1000) denoting the number of events in this test case. This integer is followed by a line with N integers, each describing an event. These integers have values between 0 and 99 (inclusive). A value between 1 and 99 means a reason for Emoogle’s giving a treat has occurred while a 0 means he has given a treat.
    The end of input will be denoted by a case with N = 0. This case should not be processed.
Output
For each test case, print a line in the format, ‘Case X: Y ’, where X is the case number and Y is the Emoogle Balance for this case.
Sample Input
5
3 4 0 0 1
4
2 0 0 0
7
1 2 3 4 5 0 0
0
Sample Output
Case 1: 1
Case 2: -2
Case 3: 3

Regionals 2010 >> Asia - Dhaka

问题链接:UVA12279 LA4853 Emoogle Balance
问题简述:(略)
问题分析
    给定n个数,统计零和非零数的个数,输出其差值。
    简单题不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA12279 LA4853 Emoogle Balance */#include <bits/stdc++.h>using namespace std;int main()
{int n, a, caseno = 0;while(~scanf("%d", &n) && n) {int ans = 0;for(int i = 0; i < n; i++) {scanf("%d", &a);if(a) ans++; else ans--;}printf("Case %d: %d\n", ++caseno, ans);}return 0;
}

UVA12279 LA4853 Emoogle Balance【水题】相关推荐

  1. 水题/poj 1852 Ants

    1 /* 2 PROBLEM:poj1852 3 AUTHER:Nicole 4 MEMO:水题 5 */ 6 #include<cstdio> 7 using namespace std ...

  2. HDU2673-shǎ崽(水题)

    如果不能够直接秒杀的题,就不算水题.又应证了那句话,有时候,如果在水题上卡住,那么此题对于你来说,也就不算是水题了额~~ 刚睡醒,迷迷糊糊. 题目的意思很简单,求一个最大的,再求一个最小的.几乎是什么 ...

  3. 图论刷水题记录(二)(最短路-----SPFA算法)

    继第一篇的后续,又来刷水题了,写的是SPFA算法,这个算法的复杂度比较玄学,感觉能不用就不用了,但是他的好处就是可以判断负圈. 3月26日: 1.POJ 1847 Tram 题意:在一个交通网络上有N ...

  4. 图论刷水题记录(一)(最短路-----dijkstra算法)

    最近实在不知道干些什么,感觉自己除了水题什么都不会做,算了去刷一刷图论的水题吧本来想合起来一起发,想了想太长的话以后看起来也不方便,题目所以今天晚上就先发了dij部分,由上到下由易变难. 1.POJ ...

  5. hdu 2041:超级楼梯(水题,递归)

    超级楼梯Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissio ...

  6. HDU2568 前进【水题】

    前进 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  7. CF Round #426 (Div. 2) The Useless Toy 思维 水题

    题目链接: http://codeforces.com/contest/834/problem/A 题目描述: 输入起始状态和结束状态和数列长度, 判断旋转方向是顺时针逆时针还是不合理 解题思路: 长 ...

  8. NUC1312 Sum【水题+数学题】

    Sum 时间限制: 1000ms 内存限制: 65536KB 通过次数: 1总提交次数: 1 问题描述 认为自然数是从1-N.将每个数和+或-联系起来,然后计算这个表达式的值我们得到一个和S.这个问题 ...

  9. Codeforces 864 A Fair Game 水题

    题目链接: http://codeforces.com/problemset/problem/864/A 题目描述: 看不是是不是一串数中只有两种数且这两种数字的数量是相同的 解题思路: 水题, 水过 ...

最新文章

  1. defensive-bash-programming
  2. qhfl-5 redis 简单操作
  3. Eclipse - CDT使用GDB调试C++的问题-无源文件命名(No source file named)
  4. 系统性能测试--杨建旭
  5. Android编译系统环境过程初始化分析【转】
  6. div+css 布局浏览器兼容
  7. Python程序设计语言基础02:Python基本图形绘制
  8. 视频图像处理基础知识0(双线性插值算法进行图像缩放)【转】
  9. keras简介(一)
  10. C++ #include头文件随想
  11. python smooth函数_利用Python程序完成ABAQUS中的一些重复性操作
  12. 秒杀或游戏让电脑时间与阿里淘宝时间同步的完整方法
  13. 最全名企笔试题+算法题
  14. 相机存储卡不小心格式化怎么恢复呢?
  15. Specification 对象的常用方法
  16. php登陆界面点登陆没有反应,ThinkPHP5实战的登录界面的登陆按钮点击之后没有任何反应怎么解决?...
  17. scratch-blocks教程(一)
  18. 从外网打点到渗透内网域控 NASA
  19. 掌握最新网管技术 做悠闲网管员
  20. duck typing java_Duck typing

热门文章

  1. [摘抄] 资深软件项目经理/产品经理“扯皮技巧”汇总(新手入坑必读,不定期更新)...
  2. arcpy.mapping常用四大件-StyleItem
  3. 一个专家眼中的Go与Java垃圾回收算法大对比
  4. Cocos Creator 编辑器扩展
  5. layer——极简的jquery弹出层插件
  6. 用Aspose.Words 从Word文档中提取表格数据
  7. 【转】初试JNI Java与C/C++交互
  8. 用 man 命令查看 ls 命令的使用手册_Python学习第167课--用man和info打开Linux命令说明书的区别...
  9. JVM GC调优参数说明
  10. idea 断点调试 以及 tomcat 无法访问