Submission #9538

# Submission time Handle Problem Language Result Execution time Memory
9538 2014-09-28T07:06:13 Z effserv Veni, vidi, vici (kriii2_V) C++
0 / 4
0 ms 1084 KB
/* 문제


*/


// 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
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -