Problem Number: 1329
Problem Name: Head or TailAuthor’s Name: Maratona de Programacao da SBC 2004, Warm-Up Brazil
Timelimit: 1
Problem Category: AD-HOC
Problem Source: https://www.urionlinejudge.com.br/judge/en/problems/view/1329
Solution:
#include <iostream>using namespace std;
int main() {
int n;
cin>>n;
while(n!=0)
{
int r;
int m=0,a=0;
for(int i=1;i<=n;i++)
{
cin>>r;
if(r==0)
m+=1;
else
a+=1;
}
cout<<"Mary won "<<m<<" times and John won "<<a<<" timesn";
cin>>n;
}
return 0;
}
No comments:
Post a Comment
Thanks..