This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/* 문제
*/
// 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 == ' ')
str[i++] = ch;
else
{
if (det2 == false)
det2 = true;
else
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |