|
|
back to boardWho Can Tell Me Wath's Wrong !? THANK YOU! #include "iostream.h" //variable long N; long Q[32]; int Qnum=0; //funtion void main() { long t; long result=0; int i,j; cin>>N; if(N<10&&N>=0) { cout<<N+10<<endl; return; } while(N>=10) { for(i=9;i>=2;i--) { if(N%i==0) { Q[Qnum]=i; Qnum++; N/=i; break; } if(i==2) { result=-1; } } } Q[Qnum]=N; for(i=0;i<=Qnum;i++) for(j=i+1;j<=Qnum;j++) { if(Q[i]>Q[j]) { t=Q[i]; Q[i]=Q[j]; Q[j]=t; } } long t2=0; for(i=0;i<=Qnum;i++) { t2=Q[i]; for(j=i;j<Qnum;j++) { t2*=10; } result+=t2; } cout<<result<<endl; } |
|
|