Advertisement
velimir

LuckyNumbers

Mar 30th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int i, j, x, dolz, l, temp;
  8.     string str;
  9.     cin >> dolz >> str;
  10.  
  11.     for(i=0; i<dolz; i++)
  12.     {
  13.         temp = 1;
  14.         if(str[i]-'0' == 2 or str[i]=='?')
  15.             for(j=0, l=i+1; j<1 and l<dolz; j++, l++)
  16.                 if(str[l]-'0'==2 or str[l]=='?')temp++;
  17.         if(temp == 2){ cout << "cool"; return 0; }
  18.  
  19.         temp = 1;
  20.         if(str[i]-'0' == 3 or str[i]=='?')
  21.             for(j=0, l=i+1; j<2 and l<dolz; j++, l++)
  22.                 if(str[l]-'0'==3 or str[l]=='?')temp++;
  23.         if(temp == 3){ cout << "cool"; return 0; }
  24.  
  25.         temp = 1;
  26.         if(str[i]-'0' == 5 or str[i]=='?')
  27.             for(j=0, l=i+1; j<4 and l<dolz; j++, l++)
  28.                 if(str[l]-'0'==5 or str[l]=='?')temp++;
  29.         if(temp == 5){ cout << "cool"; return 0; }
  30.  
  31.         temp = 1;
  32.         if(str[i]-'0' == 7 or str[i]=='?')
  33.             for(j=0, l=i+1; j<6 and l<dolz; j++, l++)
  34.                 if(str[l]-'0'==7 or str[l]=='?')temp++;
  35.         if(temp == 7){ cout << "cool"; return 0; }
  36.     }
  37.     cout << "boring";
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement