SHARE
TWEET

frog 1

a guest Jun 18th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     freopen("leapfrog_ch_.txt", "r", stdin);
  6.     freopen("IUT 0044 output.txt", "w", stdout);
  7.     int x, t, i, cnt=0, j, m=0;
  8.     cin>>t;
  9.     string a;
  10.     for(j=1; j<=t; j++)
  11.     {
  12.         cnt=0;
  13.         m=0;
  14.         cin>>a;
  15.         x=a.size();
  16.         if(x<=2)
  17.             printf("Case #%d: N\n", j);
  18.         else if(x>2)
  19.         {
  20.             for(i=0; i<x; i++)
  21.             {
  22.                 if(a[i]=='B')
  23.                     cnt++;
  24.                 if(a[i]=='A' && a[i+1]=='.' && a[i+2]=='.')
  25.                     m++;
  26.             }
  27.             if(m==0 && cnt>=x/2 && cnt<=x-2)
  28.                 printf("Case #%d: Y\n", j);
  29.             else
  30.                 printf("Case #%d: N\n", j);
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top