Cod sursa(job #1024068)
Utilizator | Data | 8 noiembrie 2013 09:29:06 | |
---|---|---|---|
Problema | Generare de permutari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <cstdio>
#include <algorithm>
using namespace std;
int n,v[100];
void afisare(){
for(int i=1;i<=n;i++) printf("%d ",v[i]);
printf("\n");
}
int main()
{
freopen("permutari.in","r",stdin);
freopen("permutari.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++) v[i]=i;
do{
afisare();
}
while(next_permutation(v+1,v+n+1));
return 0;
}