|
|
back to boardShortest solution Posted by Dranik 10 Jul 2011 22:07 int main() { int n; string s1, s2; cin >> n >> s1 >> s2; s1 += s1; int pos = (int) s1.find(s2); switch ( pos ) { case -1: cout << -1; break; case 0: cout << 0; break; default: cout << n-pos; } return 0; } Re: Shortest solution Unfortunately, your solution has been rejudged. :) string.find() is too slow. Good luck! |
|
|