#include <iostream> using namespace std; int main() { int N; int sum=0; cin>>N; string tests; cin >> tests; for (int i=0; i<N; i+=N/10){ for (int j=i; j<i+N/10; j++){ if(tests[j]=='N'){ break; } if(j==i+N/10-1){ sum++; } } } cout<<sum; return 0; }
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 | #include <iostream> using namespace std; int main() { int N; int sum=0; cin>>N; string tests; cin >> tests; for (int i=0; i<N; i+=N/10){ for (int j=i; j<i+N/10; j++){ if(tests[j]=='N'){ break; } if(j==i+N/10-1){ sum++; } } } cout<<sum; return 0; } |