Emoogle Balance

Time Limit: Unknown Memory Limit: Unknown 64bit IO Format: %lld &%llu

[Submit [GoBack  [Status]

Description

 

We have a very famous and popular fellow in our problemsetters'panel. He is so famous that his name is immaterial. Some of hisadmirers have recently given him the nickname 'Emoogle'. Let'sstick to that name in our discussion for now. Being such a kind,friendly and generous person as he is, Emoogle is often known togive treats to the other problemsetters. Some times, there is astrange rumor in the air that his treats are mostly due to the factthat, if he is not sparing enough for those treats, 'problems' arelikely to be created. But let's not pay heed to such nonsense!

\epsfbox{p4853.eps}

Now, there is another word in the air that this remarkable manis going to get married soon. To observe this special occasion withproper respect, his fellow troublemakers have decided to compile abook named '99 reasons why Emoogle should give us a treat'. Everysingle reason mentioned in this book is denoted by a number. Forexample, 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 inthe recent programming contest.
3.
He is going to join a world famous goggles manufacturingcompany soon.
4.
He has found a ticket of a soccer world cup game while digginghis 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 whichcollided with a Topcoder SRM (Single Round Match), he participatedin the SRM. (May God bless his soul!)
7.
A programming contest (may be this one?) is being arrangedcelebrating his marriage.
8.
He is getting engaged soon.
..................
99.
Solely because he is the great and kind and sweet Emoogle.


If you have any more ideas about why he should throw a party, wewould love to know. Drop us a line at emoogle.party gmail.com.

At this point, Dear brother Emoogle might want to remind usabout the number of times he has already thrown a party. Hence weintroduce the term Emoogle Balance. This is defined as:


Emoogle Balance = number of timesEmoogle is supposed to give a treat 
according to the book - number of times he has actually given thetreat.

In this problem, we want you to find Emoogle Balance. We alsowish that Emoogle Balance always keeps a healthy negative value andmay dear brother Emoogle have a very happy married lifeforever.

Input 

There are around 75 test cases in the input file. Each test casedescribes a series of events. A test case starts with aninteger N (1$ \le$N$ \le$1000) denoting the number ofevents in this test case. This integer is followed by a linewith N integers, each describingan event. These integers have values between 0 and 99 (inclusive).A value between 1 and 99 means a reason for Emoogle's giving atreat has occurred while a 0 means he has given a treat.

The end of input will be denoted by a casewith N = 0. This case should notbe processed.

Output 

For each test case, print a line in the format,`Case X: Y', where X is the case numberand Y is the Emoogle Balance forthis case.

SampleInput 

5 
3 4 0 0 1 
4 
2 0 0 0 
7 
1 2 3 4 5 0 0 
0

SampleOutput 

Case 1: 1 
Case 2: -2 
Case 3: 3
 
      
#include<iostream>
using namespace std;
int main()
{
   int n,a,s1,s2,t;
   t=0;
   while(cin>>n)
   {
           if(n==0) break;
           s1=s2=0;
   for(int i=0;i<n;i++)
    {
                cin>>a;
      if(a==0)
                  s2++;
          else 
                  s1++;
     }
   cout<<"Case "<<++t<<": "<<s1-s2<<endl;
   }
        
        return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值