Răspuns:
#include <iomanip>
#include <fstream>
#include <iostream>
#include <cassert>
using namespace std;
ifstream fin("cifreord.in");
ofstream fout("cifreord.out");
int a[10];
int main(){
int x,n;
fin >> n;
for( ; n ; n--){
fin >> x;
a[x] ++;
}
x = 0;
for(int i=0;i<10;++i)
for(int j = 1; j<= a[i] ; ++j){
fout << i << " ";
x ++;
if(x%20 == 0)
fout << endl;
}
return 0;
}
Explicație: