Created
October 29, 2016 17:27
-
-
Save takageymt/75509240f9bcd76c0802500944dbdb0b to your computer and use it in GitHub Desktop.
うっかり出しそうになったコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
int N; cin >> N; | |
string s, t; | |
cin >> s >> t; | |
string u = ""; | |
rep(i, N) u += s[i]; | |
int idx = -1; | |
rep(i, N) { | |
bool flag = true; | |
rep(j, N-i) flag &= (s[i+j] == t[j]); | |
if(flag) { | |
idx = i; | |
break; | |
} | |
} | |
if(idx == -1) idx = N; | |
reps(i, N-idx, N) u += t[i]; | |
cout << u << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment