Submission #9649

# Submission time Handle Problem Language Result Execution time Memory
9649 2014-09-28T07:49:36 Z YesUjam Veni, vidi, vici (kriii2_V) C++
0 / 4
0 ms 1084 KB
#include <cstdio>
#include <cstring>

int main() {
	int n, cnt=0;
	char temp[111111], str[103];
	scanf("%d", &n);
	getchar();
	gets(temp);
	int j=0;
	bool flag = false;
	while(temp[cnt] != ' ') {
		if(temp[cnt] == '\n') {
			flag = true;
			break;
		}
		str[j++] = temp[cnt++];
	}
	cnt++;
	str[j] = '\0';
	while(1) {
		int len = strlen(str);
		for(int i=0; i<len; i++) {
			char y = str[i];
			i++;
			if(i == len) break;
			char z = str[i];
			char x = y-'a'+z-'a'-n;
			if(x >= 26) x %= 26;
			while(x<0) {
				x+=26;
			}
			printf("%c", x+'a');
		}
		if(flag || cnt > strlen(temp)) break;
		printf(" ");
		int j=0;
		while(cnt <= strlen(temp) && temp[cnt] != ' ') {
			if(temp[cnt] == '\n') {
				flag = true;
				break;
			}
			str[j++] = temp[cnt++];
		}
		cnt++;
		str[j] = '\0';
	}
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1084 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -