#include <bits/stdc++.h>
using namespace std;
int main(){
int n, wynik = 10, czy = 0;
string x;
cin >> n >> x;
for(int i = 0; i < n; i++){
czy = max(czy,(int)(x[i] == 'N'));
if( i %(n/10) == (n/10)-1){
wynik-=czy;
czy = 0;
}
}
cout << wynik << endl;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <bits/stdc++.h> using namespace std; int main(){ int n, wynik = 10, czy = 0; string x; cin >> n >> x; for(int i = 0; i < n; i++){ czy = max(czy,(int)(x[i] == 'N')); if( i %(n/10) == (n/10)-1){ wynik-=czy; czy = 0; } } cout << wynik << endl; return 0; } |
English