#include<iostream> #include<cstdio> using namespace std; inline int read() { int n=0,f=1,ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { n=n*10+ch-'0'; ch=getchar(); } return n*f; } char s[100005]; int main() { int n; n=read(); scanf("%s",s+1); int ans=0; for(int i=1;i<=10;i++) { bool flag=true; for(int j=n/10*(i-1)+1;j<=n/10*i;j++) { if(s[j]=='N') { flag=false; break; } } if(flag==true)ans++; } printf("%d\n",ans); }
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<iostream> #include<cstdio> using namespace std; inline int read() { int n=0,f=1,ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { n=n*10+ch-'0'; ch=getchar(); } return n*f; } char s[100005]; int main() { int n; n=read(); scanf("%s",s+1); int ans=0; for(int i=1;i<=10;i++) { bool flag=true; for(int j=n/10*(i-1)+1;j<=n/10*i;j++) { if(s[j]=='N') { flag=false; break; } } if(flag==true)ans++; } printf("%d\n",ans); } |