Cod sursa(job #382526)
Utilizator | Data | 13 ianuarie 2010 20:25:18 | |
---|---|---|---|
Problema | Generare de permutari | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <fstream>
#include <algorithm>
using namespace std;
ifstream in("permutari.in");
ofstream out("permutari.out");
int main () {
int myints[] = {1,2,3,4,5,6,7,8};
int y;
in>>y;
sort (myints,myints+y);
do {
for(int i=0;i<y;i++)
out<<myints[i]<<" ";
out<<endl;
} while ( next_permutation (myints,myints+y) );
return 0;
}