Cod sursa(job #2621412)
Utilizator | Data | 30 mai 2020 14:38:04 | |
---|---|---|---|
Problema | Sortare prin comparare | Scor | 60 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
#include <map>
#include <iterator>
using namespace std;
int main()
{
int n;
unsigned long x;
map <unsigned long,int> numere;
ifstream f("algsort.in");
ofstream g("algsort.out");
f>>n;
for(int i = 0; i < n; i++)
{
f>>x;
numere[x]++;
}
for(auto itr : numere)
{
for(int i = 0; i < itr.second;i++)
g<<itr.first<<" ";
}
}