#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
string str; cin>>str;
int ans = 0;
int k = n / 10;
for(int i= 0; i < 10; i++){
bool good = true;
for(int j = i*k; j < (i+1) * k; j++){
if(str[j] == 'N'){
good = false;
break;
}
}
if(good)ans++;
}
cout<<ans;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string str; cin>>str; int ans = 0; int k = n / 10; for(int i= 0; i < 10; i++){ bool good = true; for(int j = i*k; j < (i+1) * k; j++){ if(str[j] == 'N'){ good = false; break; } } if(good)ans++; } cout<<ans; } |
English