Submission #9329

# Submission time Handle Problem Language Result Execution time Memory
9329 2014-09-28T05:36:56 Z levant916 Veni, vidi, vici (kriii2_V) C++14
0 / 4
0 ms 1676 KB
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;


string key[100];

string solve(string str, int n) {
	string ans;
	int cnt = str.size();
	if (cnt % 2 == 1) cnt--;
	for (int i = 0; i < cnt; i+=2) {
		ans.push_back((str[i] - 'a' + str[i + 1] - 'a' - n + 26) % 26 + 'a');
	}
	return ans;
}

int main(void) {

	int n;
	cin >> n;
	char in;
	int cnt = 0;
	string str;
	
	char str2[101];
	char c;
	getchar();
	do {
		c = getchar();
		if (c == ' ') {
			cnt++;
		}else if (c != '\n' ){
			key[cnt].push_back(c);
		}
	} while (c != '\n');
	
	for (int i = 0; i < cnt + 1; i++) {
		if (i != 0) cout << ' ';
		cout << solve(key[i], n) ;
	}
	cout << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -