Sunday, August 28, 2016

uri-1329 - Head or Tail

#include<stdio.h>
int main()
{
    int b[10001],jo,j,n,i,m;

while(scanf("%d",&n)==1){
        m=0,jo=0;
       if(n==0){
        break;
       }
   for(i=0;i<n;i++){
        scanf("%d",&b[i]);
        }
   for(j=0;j<n;j++){
        if(b[j]==0){
            m++;
        }
        else{
            jo++;
        }
     }
    printf("Mary won %d times and John won %d times\n",m,jo);
  }
    return 0;
}

No comments: