Submission #3134

#TimeUsernameProblemLanguageResultExecution timeMemory
3134movie_jo생일수 I (GA4_birthday1)C11
0 / 100
88 ms16712 KiB
#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); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...