Submission #16311

# Submission time Handle Problem Language Result Execution time Memory
16311 2015-08-20T11:07:58 Z who7117 뚊 (kriii3_EE) C++
0 / 20
0 ms 1080 KB
#include<stdio.h>
#include<string.h>
#define MAX 100

int compare(char*, char*, int);        
int _input(int, int);

int main()
{
	unsigned int N, M, result;
	char eyfa[MAX], eeyfa[MAX];
	char eyfa2[MAX], eeyfa2[MAX];

	scanf("%d %d", &N, &M);		// N : stage      M : eyfa size
	int n = 0;
	while (n < N)
	{
		if (n == 0)
		{
			fflush(stdin);
			fgets(eyfa, M + 2, stdin);		// why +2?
			eyfa[strlen(eyfa) - 1] = '\0';			// '\n' change
		}
		else if (n == 1)
		{
			fflush(stdin);
			fgets(eyfa2, M + 2, stdin);		// why +2?
			eyfa2[strlen(eyfa2) - 1] = '\0';			// '\n' change
		}
		n++;
	}
	while (N > 0)
	{
		if (N == 2)
		{
			fflush(stdin);
			fgets(eeyfa, sizeof(eeyfa), stdin);
			eeyfa[strlen(eeyfa) - 1] = '\0';
		}
		else if (N == 1)
		{
			fflush(stdin);
			fgets(eeyfa2, sizeof(eeyfa2), stdin);
			eeyfa2[strlen(eeyfa2) - 1] = '\0';
		}
		N--;
	}

	result = compare(eyfa, eeyfa, M);
	if (result == 0) printf("Eyfa");
	else printf("Not Eyfa");
	printf("\n");

	result = compare(eyfa2, eeyfa2, M);
	if (result == 0) printf("Eyfa");
	else printf("Not Eyfa");
	printf("\n");

	return 0;
}
int compare(char *str1, char *str2, int M)
{
	int cnt = 0;

	for (int i = 0; i < M; i++)
	{
		for (int y = cnt; cnt < y + 2; cnt++)
		{
			if (str1[i] != str2[cnt]) return 1;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1080 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 -