Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: cheetah
Problemset: เลขฐานเบญจภาคได้ดุล
Language: cpp
Time: 0.003 second
Submitted On: 2026-07-18 22:40:25
#include<bits/stdc++.h>
using namespace std;
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0;i < n; ++i) {
int x, y;
cin >> x;
vector<int> v;
int a = 0;
while (true) {
if (x < 0) {
x = -x;
a = 1;
}
if (x % 5 >= 3) {
y = (x / 5) + 1;
}
else {
y = x / 5;
}
v.push_back(x - (5 * y));
x = y;
if (x <= 1) {
break;
}
}
if (x % 2 != 0) {
v.push_back(x);
}
if (a == 0) {
for (int j = 0; j < v.size(); ++j) {
cout << v[j] << " ";
}
cout << "\n";
}
else {
for (int j = 0; j < v.size(); ++j) {
cout << -v[j] << " ";
}
cout << "\n";
}
}
return 0;
}