#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
string input;
cin >> input;
int score = 0;
bool wrong = 0;
for(int i = 1; i <= n; ++i)
{
if(input[i - 1] == 'N')
wrong = 1;
if(i % (n / 10) == 0 && !wrong)
++score;
if(i % (n / 10) == 0)
wrong = 0;
}
cout << score;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string input; cin >> input; int score = 0; bool wrong = 0; for(int i = 1; i <= n; ++i) { if(input[i - 1] == 'N') wrong = 1; if(i % (n / 10) == 0 && !wrong) ++score; if(i % (n / 10) == 0) wrong = 0; } cout << score; } |
English