|
|
вернуться в форумCan somebody help me ? #include<iostream> #include<string> using namespace std; string s1,s2,t; int main() { int n,i=0,j,sz; cin>>n; cin>>s1>>t; while(1) { if(s1==t) { cout<<i<<endl; break; } if(i>=n) { cout<<"-1"<<endl; break; } s2=s1.at(n-1); s1.erase(n-1); s2+=s1; s1=s2; i++; } return 0; } I get time limit -- > Time limit exceeded 8 1.015 Can somebody help me with an idea how to make it run faster ? Thanks in advance :) Edited by author 29.12.2008 14:48 |
|
|