Pagini recente » Cod sursa (job #2210103) | Cod sursa (job #524715) | Cod sursa (job #2557758) | Cod sursa (job #1789032) | Cod sursa (job #1740711)
#include <fstream>
using namespace std;
unsigned short int K;
unsigned int Ni;
unsigned int photos[20000001];
unsigned int temp;
unsigned int i, j;
unsigned int X;
int main ()
{
ifstream fin ("interclasari.in");
fin >> K;
for (i=1; i<=K; i++)
{
fin >> Ni;
for (j=1; j<=Ni; j++)
{
X++;
fin >> photos[X];
}
}
fin.close();
for (i=1; i<=X; i++)
{
for (j=2; j<=X; j++)
if (photos[j] < photos[j-1])
{
temp = photos[j];
photos[j] = photos[j-1];
photos[j-1] = temp;
}
}
ofstream fout ("interclasari.out");
fout << X << '\n';
for (i=1; i<=X; i++)
fout << photos[i] << ' ';
fout.close();
return 0;
}