Submission #3135

# Submission time Handle Problem Language Result Execution time Memory
3135 2013-08-26T07:06:43 Z movie_jo 생일수 I (GA4_birthday1) C
14 / 100
76 ms 16712 KB
#include <stdio.h>

struct X {
	int exist;
	int three;
	int five;
	int eight;
} x[1000001];

int main(void)
{
	int T, n, i;

	x[1].exist = -1;
	x[2].exist = -1;
	x[4].exist = -1;
	x[7].exist = -1;

	x[3].three = 1;
	x[5].five = 1;
	x[6].three = 2;
	x[8].eight = 1;

	for(i = 9; i <= 1000000; i++)
	{
		if(x[i - 8].exist == 0)
		{
			x[i].three = x[i - 8].three;
			x[i].five = x[i - 8].five;
			x[i].eight = x[i - 8].eight + 1;
		}
		else if(x[i - 5].exist == 0)
		{
			x[i].three = x[i - 5].three;
			x[i].five = x[i - 5].five + 1;
			x[i].eight = x[i - 5].eight;
		}
		else
		{
			x[i].three = x[i - 3].three + 1;
			x[i].five = x[i - 3].five;
			x[i].eight = x[i - 3].eight;
		}
	}

	scanf("%d", &T);

	while(T--)
	{
		scanf("%d", &n);

		if(x[n].exist)
			printf("-1");
		else
		{
			for(i = 0; i < x[n].three; i++)
				printf("3");
			for(i = 0; i < x[n].five; i++)
				printf("5");
			for(i = 0; i < x[n].eight; i++)
				printf("8");
		}
		printf("\n");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 16712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 16712 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 16712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 16712 KB Output isn't correct
2 Halted 0 ms 0 KB -