Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: navysrimuang
Problemset: เลขฐานเบญจภาคได้ดุล
Language: cpp
Time: 0.004 second
Submitted On: 2025-10-12 14:21:28
#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;
}
while(n!= 0){
int r = n%5;
if(r>2){
r -= 5;
}
cout << (isneg ? -r:r) <<" ";
n -= r;
n/=5;
}
cout << endl;
}
return 0;
}