Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: loop
Problemset: เลขฐานเบญจภาคได้ดุล
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-10 18:33:12
#include <cstdio>
int main() {
int k;
scanf("%d", &k);
while (k--) {
int x;
scanf("%d", &x);
if (x == 0) { printf("0\n"); continue; }
bool first = true;
while (x != 0) {
int d = ((x % 5) + 5) % 5; // 0..4
if (d > 2) d -= 5; // -2..2
printf(first ? "%d" : " %d", d);
first = false;
x = (x - d) / 5;
}
printf("\n");
}
return 0;
}