Problema 284 pbinfo. Ajutati-maaa !!!!
Răspunsuri la întrebare
#include <iostream>
#include <fstream>
using namespace std;
int a[100001], b[100001], c[200001];
int main()
{
ifstream f("interclasare3.in");
ofstream g("interclasare3.out");
int n, m, i, j, k=1;
f >> n >> m;
for (i=1; i<=n; ++i) f >> a[i];
for (i=1; i<=m; ++i) f >> b[m+1-i];
i=1; j=1;
while (i<=n && j<=m)
{
if (a[i]<b[j])
{ c[k]=a[i]; ++i; }
else {c[k]=b[j]; ++j; }
++k;
}
if (i<=n)
while (i<=n)
{
c[k]=a[i]; ++k; ++i;
}
else
while (j<=m)
{
c[k]=b[j]; ++k; ++j;
}
k=0;
for (i=1; i<=n+m; ++i)
if (c[i]%2==0)
{
++k;
if (k%20) g<< c[i] << " ";
else g<< c[i]<< "\n";
}
return 0;
}