Project Euler/24
Jump to navigation
Jump to search
The problem 24 of Project Euler is to find out the 1000000th lexicographic permutation of 0~9.
Implementations
C++
#include<iostream>
#include<algorithm>
using namespace std;
int a[10]={0,1,2,3,4,5,6,7,8,9};
int main(){
for(int i=1;i<1000000;i++) next_permutation(a,a+10);
for(int i=0;i<10;i++) cout<<a[i];
return 0;
}
Unfortunately, this does not work on the answer checking in Project Euler Mirror, but this is technically correct, isn't it?