#include<cstdio> using namespace std; int main() { int n,t,p=0; scanf("%d",&n); t=n/10; bool ok=1; int i=0; char c; while(n--) { ++i; if(i%t==0) { if(ok)p++; ok=1; } scanf("%c%",&c); ok=ok&&c=='T'; } printf("%d\n",p); 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 | #include<cstdio> using namespace std; int main() { int n,t,p=0; scanf("%d",&n); t=n/10; bool ok=1; int i=0; char c; while(n--) { ++i; if(i%t==0) { if(ok)p++; ok=1; } scanf("%c%",&c); ok=ok&&c=='T'; } printf("%d\n",p); return 0; } |