Submission
Status:
-PPPPPPP-P
Subtask/Task Score:
80/100
Score: 80
User: matcherbrainner
Problemset: เลขฐานเบญจภาคได้ดุล
Language: cpp
Time: 0.006 second
Submitted On: 2026-10-09 09:30:05
#include<bits/stdc++.h>
using namespace std;
void solve(int n){
if(n==0){cout<<"0";return;}
bool f=true;
while(n!=0){
int r=n%5;
if(r<0)r+=5;
if(r>2)r-=5;
cout<<(f?"":" ")<<r;
f=false;
n=(n-r)/5;
}
cout<<"\n";
}
int main(){
int k;
cin>>k;
while(k--){
int u;
cin>>u;
solve(u);
}
}