#include <bits/stdc++.h> using namespace std; int main(){ int n, score = 0; string a; cin >> n >> a; for(int i = 0; i < 10; i++){ bool allOk = 1; for(int j = 0; j < (n / 10); j++){ if(a[i * (n / 10) + j] == 'N'){ allOk = 0; } } score += (int)allOk; } cout << score << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <bits/stdc++.h> using namespace std; int main(){ int n, score = 0; string a; cin >> n >> a; for(int i = 0; i < 10; i++){ bool allOk = 1; for(int j = 0; j < (n / 10); j++){ if(a[i * (n / 10) + j] == 'N'){ allOk = 0; } } score += (int)allOk; } cout << score << endl; } |