shipu_a

Div 1 Problem F

Jan 15th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include<cstdio>
  2. #include<cstdlib>
  3. int main()
  4. {
  5.     int test,t=0,i;
  6.     char a[100];
  7.     scanf("%d",&test);
  8.     while(test--)
  9.     {
  10.         scanf("%s",a);
  11.         int count_odd=0;
  12.         int count_even=0;
  13.         for(i=0;a[i]!='\0';i++)
  14.         {
  15.             if((a[i]-'0')%2==0)
  16.                 count_even++;
  17.             else
  18.                 count_odd++;
  19.         }
  20.         if(abs(count_odd-count_even)==0||abs(count_odd-count_even)==1)
  21.             printf("Case %d# Yes\n",++t);
  22.         else
  23.             printf("Case %d# No\n",++t);
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment