Submission #9195

#TimeUsernameProblemLanguageResultExecution timeMemory
9195coreaVeni, vidi, vici (kriii2_V)C++14
4 / 4
0 ms1676 KiB
#include <cstdio>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>

using namespace std;

int n;
vector<string> a;

void go() {
	int P[26][26];
	for(int x = 0; x < 26; ++ x) {
		for(int y = 0; y < 26; ++ y) {
			for(int z = 0; z < 26; ++ z) {
				if(x % 26 == (y + z - n + 26) % 26) {
					P[y][z] = x;
				}
			}
		}
	}
	for(string &s : a) {
		for(int i=0; i+1<(int) s.length(); i += 2) {
			int y = s[i] - 'a';
			int z = s[i+1] - 'a';
			int x = P[y][z];
			printf("%c", x + 'a');
		}
		printf(" ");
	}
}

int main() {
	while(cin >> n) {
		string s;
		while(cin >> s) {
			a.push_back(s);
		}
		go();
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...