Cod sursa(job #254516)
| Utilizator | Data | 7 februarie 2009 12:38:26 | |
|---|---|---|---|
| Problema | Planeta | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Stelele Informaticii 2009, clasele 9-10, ziua 2 | Marime | 0.52 kb |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector< int >v;
int main () {
freopen("planeta.in", "r", stdin);
freopen("planeta.out", "w", stdout);
int N,K;
scanf("%d%d",&N,&K);
for (int i = 1; i <= N; ++i)
v.push_back(i);
int i=0;
do{
++i;
if( i==K )
{
for (int i = 0; i < N; ++i)
printf("%d ",v[i]);
printf("\n");
return 0;
}
} while (next_permutation(v.begin(), v.end()));
return 0;// warning: this doesn't actually work, but hey
}