This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
string arr;
int n;
char en(int a,int b)
{
a += b;
a -= n;
if(a < 0) a += 25;
a %= 26;
a += (int)'a';
return (char)a;
}
int main()
{
scanf("%d",&n);
getchar();
getline(cin,arr);
for(int i = 0;i < arr.length(); i += 2)
{
if(i + 1 >= arr.length() || arr[i + 1] == ' '){
printf(" ");
continue;
}
char a = en((int)(arr[i] - 'a'),(int)(arr[i + 1] - 'a'));
printf("%c",a);
if(arr[i + 2] == ' '){
printf(" ");
i++;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |