#include <bits/stdc++.h> using namespace std; signed main(){ int n; cin>>n; int len = n/10; int res = 0; for(int block = 0;block<10;block+=1){ bool flag = 1; for(int i = 0;i<len;i+=1){ char val; cin>>val; flag = min(flag,val=='T'); } res += flag; } cout<<res<<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <bits/stdc++.h> using namespace std; signed main(){ int n; cin>>n; int len = n/10; int res = 0; for(int block = 0;block<10;block+=1){ bool flag = 1; for(int i = 0;i<len;i+=1){ char val; cin>>val; flag = min(flag,val=='T'); } res += flag; } cout<<res<<endl; } |