You are viewing a single comment's thread. Return to all comments →
why my 7,8 and 9 test case are wrong
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ long long int n; cin>>n;n--; string fact = ""; int i=1; while(n){ fact = to_string(n%i) + fact; n/=i; i++; } fact = string(13-fact.length(),'0') + fact; //cout<<fact<<"\n"; string res = "abcdefghijklm",result; for(int i=0;i<fact.length();i++){ int index = (fact[i]-'0'); result+=res[index]; res.erase(index, 1); } cout<<result<<"\n"; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #24: Lexicographic permutations
You are viewing a single comment's thread. Return to all comments →
why my 7,8 and 9 test case are wrong