Cod sursa(job #383466)
Utilizator | Data | 16 ianuarie 2010 17:28:23 | |
---|---|---|---|
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 () {
short myints[] = {1,2,3,4,5,6,7,8};
int y;
in>>y;
sort (myints,myints+y);
do {
for(short i=0;i<y;i++)
out<<myints[i]<<" ";
out<<endl;
} while ( next_permutation (myints,myints+y) );
return 0;
}