# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20128 |
2016-02-27T09:16:25 Z |
hongjun7 |
생일수 I (GA4_birthday1) |
C++14 |
|
674 ms |
16708 KB |
#include <stdio.h>
#define MAXN 1000000
int T, n, d[MAXN + 5], x[3] = { 3,5,8 }, v[MAXN + 5][3];
int main() {
for (int i = 1; i <= MAXN; i++) d[i] = MAXN;
for (int i = 0; i < 3; i++) {
for (int j = x[i]; j <= MAXN; j++) {
if (d[j - x[i]] + 1 < d[j]) {
d[j] = d[j - x[i]] + 1;
for (int k = 0; k < 3; k++) v[j][k] = v[j - x[i]][k];
v[j][i]++;
}
}
}
for (scanf("%d", &T); T--; ) {
scanf("%d", &n);
if (d[n] == MAXN) puts("-1");
else {
for (int i = 0; i < 3; i++) for (int j = 1; j <= v[n][i]; j++) printf("%d", x[i]);
puts("");
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
16708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
16708 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
674 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |