Submission #9544

#TimeUsernameProblemLanguageResultExecution timeMemory
9544effservVeni, vidi, vici (kriii2_V)C++98
1 / 4
0 ms1088 KiB
/* 문제 */ // 2014. #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <functional> #include <cstring> #include <string> #include <map> using namespace std; int n; char str[200]; char ans[200]; bool tmp = false; int main() { scanf("%d", &n); char ch; int i = 0; bool det2 = false; while (1) { ch = getchar(); if ((ch >= 'a' && ch <= 'z') || ch == ' ') det2 = true,str[i++] = ch; else { if (det2 == true) break; } } int len = strlen(str); i = 0; int pos = 0; for (; str[i] != 0; i++) { char s = ((str[i + 0] - 'a' + str[i + 1] - 'a') - n); if (str[i + 1] == 0) break; if (str[i + 1] == ' ') { if (ans[pos - 1] != ' ') ans[pos++] = ' '; continue; } if (str[i] == ' ') { if (ans[pos - 1] != ' ') ans[pos++] = ' '; continue; } else { ans[pos++] = (s >= 0 ? s : 26 + s) % 26 + 'a'; i++; } } printf("%s", ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...