URI Head or Tail
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin >> n)
{
if(!n)break;
int mary=0,john=0;
for(int i=0;i<n;i++)
{
int x;
cin >> x;
if(!x)
{
mary++;
}
else
{
john++;
}
}
cout << "Mary won " << mary << " times and John won " << john << " times" << endl;
}
return 0;
}
using namespace std;
int main()
{
int n;
while(cin >> n)
{
if(!n)break;
int mary=0,john=0;
for(int i=0;i<n;i++)
{
int x;
cin >> x;
if(!x)
{
mary++;
}
else
{
john++;
}
}
cout << "Mary won " << mary << " times and John won " << john << " times" << endl;
}
return 0;
}
Comments
Post a Comment