Challenge Template

Init

void timeout()
{
	puts("timeout!");
	exit(0);
}

void init_binary()
{
	setvbuf(stdin, NULL, _IONBF, 0);
	setvbuf(stdout, NULL, _IONBF, 0);
	setvbuf(stderr, NULL, _IONBF, 0);

	signal(14, timeout);
	alarm(60);

	return;
}

Input

int scan(char *buf, unsigned int len)
{
	int res = read(0, buf, len);
	if (res < 0)
	{
		perror("error : read");
		exit(-3);
	}

	if (buf[res-1]=='\x0a')
	{
		buf[res-1] = '\x00';
	}
	return res;
}

int scan_int()
{
	char buf[0x18];
	memset(buf, 0, 0x18);
	
	scan(buf, 0x10);	
	return atoi(buf);
}

추가할 예정,, 귀찬하