Advertisement
Josif_tepe

Untitled

Jul 20th, 2024
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.44 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main(){
  5.   int n;
  6.   cin >> n;
  7.  
  8.   string s;
  9.   cin >> s;
  10.  
  11.   string two = s;
  12.   for(int i = 0; i < n; i++) {
  13.     if(two[i] == '?') {
  14.       two[i] = '2';
  15.     }
  16.   }
  17.   int cnt = 0;
  18.   for(int i = 0; i < n; i++) {
  19.     if(two[i] == '2') {
  20.       cnt++;
  21.     }
  22.     else {
  23.       cnt = 0;
  24.     }
  25.     if(cnt >= 2) {
  26.       cout << "cool" << endl;
  27.       return 0;
  28.     }
  29.   }
  30.  
  31.   string three = s;
  32.   cnt = 0;
  33.   for(int i =0 ; i < n; i++) {
  34.     if(three[i] == '?') {
  35.       three[i] = '3';
  36.     }
  37.   }
  38.   for(int i = 0; i < n; i++) {
  39.     if(three[i] == '3') {
  40.       cnt++;
  41.     }
  42.     else {
  43.       cnt = 0;
  44.     }
  45.     if(cnt >= 3) {
  46.       cout << "cool" << endl;
  47.       return 0;
  48.     }
  49.   }
  50.   string fives = s;
  51.   for(int i = 0; i < n; i++) {
  52.     if(fives[i] == '?') {
  53.       fives[i] = '5';
  54.     }
  55.   }
  56.   cnt = 0;
  57.   for(int i = 0; i < n; i++) {
  58.     if(fives[i] == '5'){
  59.       cnt++;
  60.     }
  61.     else {
  62.       cnt = 0;
  63.     }
  64.     if(cnt >= 5) {
  65.       cout << "cool" << endl;
  66.       return 0;
  67.     }
  68.   }
  69.   string sevens = s;
  70.   for(int i = 0; i < n; i++) {
  71.     if(sevens[i] == '?') {
  72.       sevens[i] = '7';
  73.     }
  74.   }
  75.   cnt = 0;
  76.  
  77.   for(int i = 0; i < n; i++) {
  78.     if(sevens[i] == '7') {
  79.       cnt++;
  80.     }
  81.     else {
  82.       cnt = 0;
  83.     }
  84.     if(cnt >= 7) {
  85.       cout << "cool" << endl;
  86.       return 0;
  87.     }
  88.   }
  89.   cout << "boring" << endl;
  90.  return 0;
  91. }
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement