이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstring>
int main() {
int n, cnt=0;
char temp[111111], str[103];
scanf("%d", &n);
getchar();
gets(temp);
int j=0;
bool flag = false;
while(temp[cnt] != ' ') {
if(temp[cnt] == '\n') {
flag = true;
break;
}
str[j++] = temp[cnt++];
}
cnt++;
str[j] = '\0';
while(1) {
int len = strlen(str);
for(int i=0; i<len; i++) {
char y = str[i];
i++;
if(i == len) break;
char z = str[i];
char x = y-'a'+z-'a'-n;
if(x >= 26) x %= 26;
while(x<0) {
x+=26;
}
printf("%c", x+'a');
}
if(flag || cnt > strlen(temp)) break;
printf(" ");
int j=0;
while(cnt < strlen(temp) && temp[cnt] != ' ') {
if(temp[cnt] == '\n') {
flag = true;
break;
}
str[j++] = temp[cnt++];
}
cnt++;
str[j] = '\0';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |