Submission #9526

# Submission time Handle Problem Language Result Execution time Memory
9526 2014-09-28T07:02:46 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()
{
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
#endif

	scanf("%d", &n);
	char ch;
	int i = 0;

	fflush(stdin);

	while (1)
	{
		ch = getchar();
		if ((ch >= 'a' && ch <= 'z') || ch == ' ')
			str[i++] = ch;
		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] == ' ')
			{
				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 Runtime error 0 ms 1084 KB lseek (syscall #8) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -