|
|
back to boardWhy WA 1 I've counted 'a','ab','abc' and other subsequences and got satisfying to condition.... #include <bits/stdc++.h> using namespace std; int main() { string letter="abcdefghijklmnopqrstuvwxyz"; int k=letter.size(); int i1,i2,i3; string part,bigpart; for(i1=0;i1<k;i1++) { for(i2=0;i2<k;i2++) { for (i3=0;i3<k;i3++) { part=""; part.pb(letter[i1]); if(part[0]!=letter[i2]) part.pb(letter[i2]); else continue; if(part[0]!=letter[i3]&&part[1]!=letter[i3]) part.pb(letter[i3]); else continue; bigpart.pb(letter[i1]);bigpart.pb(letter[i2]);bigpart.pb(letter[i3]); } } } string ans=""; //cout<<bigpart.size()/3; while(ans.size()<1000000) { ans=ans+bigpart; } /*for (int i=0;i<1000000;i++) { cout<<ans[i]; }*/ int res=0; for (int i=0;i<1000000;i++) { if (ans.substr(i,1)=="a") res++; } cout<<res; return 0; } Maybe 1 test is a sort of tricky? Edited by author 06.04.2017 01:18 |
|
|