#include "bits/stdc++.h"
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
int K = N/10;
string znak;
cin >> znak;
int pom = 10;
int wynik = 10;
int pom1 = 0, pom2 = K;
while(pom > 0){
for(int j = pom1; j < pom2; j++){
if(znak[j] == 'N'){
wynik--;
break;
}
}
pom1 += K;
pom2 += K;
pom--;
}
cout << wynik << endl;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include "bits/stdc++.h" using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; int K = N/10; string znak; cin >> znak; int pom = 10; int wynik = 10; int pom1 = 0, pom2 = K; while(pom > 0){ for(int j = pom1; j < pom2; j++){ if(znak[j] == 'N'){ wynik--; break; } } pom1 += K; pom2 += K; pom--; } cout << wynik << endl; } |
English