Advertisement
Josif_tepe

Untitled

Feb 17th, 2024
971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.     string s;
  7.     cin >> s;
  8.     int klikovi = 0;
  9.     for(int i = 0; i < s.size(); i++) {
  10.         if(s[i] == 'Y') {
  11.             for(int j = i; j < s.size(); j += i + 1) {
  12.                 if(s[j] == 'Y') {
  13.                     s[j] = 'N';
  14.                 }
  15.                 else {
  16.                     s[j] = 'Y';
  17.                 }
  18.             }
  19.             klikovi++;
  20.         }
  21.     }
  22.     cout << klikovi << endl;
  23.     return 0;
  24.                
  25. }
  26. // NNNNNNNNaN
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement