#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
long int a,b,c,d;
cin>>a;
for(int x=0;x<a;x++){
cin>>b;
c=0;
d=0;
if(b==1){
c=1;
}
for(int y=9;y>=2;y--){
while(b%y==0){
b=b/y;
c=c+(y*pow(10,d));
d++;
}
}
if(b==1){
cout<<c;
}else{
cout<<"-1";
}
cout<<endl;
}
system("pause");
return 0;
}
#include<iomanip>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
long int a,b,c,d;
cin>>a;
for(int x=0;x<a;x++){
cin>>b;
c=0;
d=0;
if(b==1){
c=1;
}
for(int y=9;y>=2;y--){
while(b%y==0){
b=b/y;
c=c+(y*pow(10,d));
d++;
}
}
if(b==1){
cout<<c;
}else{
cout<<"-1";
}
cout<<endl;
}
system("pause");
return 0;
}
沒有留言:
張貼留言