Submission
Status:
-PPPPPPP-P
Subtask/Task Score:
80/100
Score: 80
User: navysrimuang
Problemset: เลขฐานเบญจภาคได้ดุล
Language: cpp
Time: 0.004 second
Submitted On: 2025-10-06 13:08:07
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(){
int t;cin >> t;
while(t--){
int tmp; cin >> tmp;
int n = abs(tmp);
bool isneg = false;
if(tmp>0){
isneg = false;
}else{
isneg = true;
}
if(n == 0){
cout << 0 << endl;
}
while(n!= 0){
int r = n%5;
if(r>2){
r -= 5;
}
cout << (isneg ? -r:r) << " ";
n -= r;
n/=5;
}
cout << endl;
}
return 0;
}