#include <bits/stdc++.h> #define ll long long #define llu long long unsigned #define ld long double #define fr(i,n) for(int i=0;i<n;i++) #define fr2(i,l,r) for(int i=l;i<r;i++) #define watch(x) cout<<(#x)<<"=="<<(x)<<endl #define ft first #define sc second #define pb push_back #define vi vector<int> #define pii pair<int,int> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int T; cin>>T; string s; cin>>s; int step=T/10,res=0; for(int i=0;i<10;i++) { //watch(i); watch(res); int reward=1; //watch(step); for(int j=0;j<step;j++) { //watch(i*step+j); if(s[i*step+j]=='N') { reward=0; break; } } res+=reward; } cout<<res<<'\n'; 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <bits/stdc++.h> #define ll long long #define llu long long unsigned #define ld long double #define fr(i,n) for(int i=0;i<n;i++) #define fr2(i,l,r) for(int i=l;i<r;i++) #define watch(x) cout<<(#x)<<"=="<<(x)<<endl #define ft first #define sc second #define pb push_back #define vi vector<int> #define pii pair<int,int> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int T; cin>>T; string s; cin>>s; int step=T/10,res=0; for(int i=0;i<10;i++) { //watch(i); watch(res); int reward=1; //watch(step); for(int j=0;j<step;j++) { //watch(i*step+j); if(s[i*step+j]=='N') { reward=0; break; } } res+=reward; } cout<<res<<'\n'; return 0; } |