fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long N;
  6. cin>>N;
  7.  
  8. int div[10]={0};
  9. for(int k=9;k>1;)
  10. if(N%k==0){
  11. div[k]++;
  12. N/=k;
  13. }else
  14. k--;
  15. if(N==1)
  16. for(int i=2;i<10;i++)
  17. for(int j=0;j<div[i];j++)
  18. cout<<i;
  19. else
  20. cout<<"0";
  21. return 0;
  22. }
Success #stdin #stdout 0s 15232KB
stdin
4 11
809 
432
345
678
stdout
4