UVa 263 - Number Chains
// Accepted ==================== Approach : 1 ========================== #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<LL>vll; typedef map<LL, bool> mpbll; vll v1 , v2; void get_num(LL n) { v1.clear(); v2.clear(); while(n) { v1.push_back(n % 10); v2.push_back(n % 10); n/=10; } //for(int i=0; i<v1.size(); i++) cout << v1[i] << " "; } LL one() { LL r=0; sort(v1.begin() , v1.end()); int len=v1.size(); for(int i=0; i<len; i++) { r = v1[i] + (r * 10); } return r; } LL two() { LL r=0; sort(v2.rbegin() , v2.rend()); int len = v2.size(); for(int i=0; i<len; i++) { r = v2[i] + ( r * 10); } return r; } int main() { ios_base::sync_with_stdio(0); LL n; mpbll mp; while(cin >> n and n) { mp.clear(); // get_num(n); // LL a = one(); //cout <<