|
|
back to boardwa#5 why? help! #include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; int main(int argc, char** argv){ long long int n; cin>>n; vector<char> v; if(n == 1){ cout<<1; return 0; } else if(n == 0){ cout<<10; return 0; } int cur = 9; while(n!=1){ bool flag = false; for(; cur>=2; --cur){ if(n/cur*cur==n){ flag = true; v.push_back(cur); n = n/cur; cur = 9; } } if(!flag){ cout<<-1; return 0; } } sort(v.begin(), v.end()); long long int a = 0; for(int i = 0; i<v.size(); i++){ a = a*10 + v.at(i); } cout<<a; } |
|
|