#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n; cin>>n; int m = n/10; int res = 0; for(int j=0;j<10;j++){ bool passed = true; for(int i=0;i<m;i++){ char x; cin>>x; if(x == 'N') passed = false; } if(passed) res++; } cout<<res<<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n; cin>>n; int m = n/10; int res = 0; for(int j=0;j<10;j++){ bool passed = true; for(int i=0;i<m;i++){ char x; cin>>x; if(x == 'N') passed = false; } if(passed) res++; } cout<<res<<endl; } |