753 afișări Filip Adela (filip_adela) 20.03.2020 www.pbinfo.ro
Etichete: nicio etichetă

#include <iostream>
#include <fstream>
using namespace std;
ifstream fin(“bac.in”);
int a10001,b10001,m,n,i,j,ok=0;
int main()
{ fin>>m>>n; for(i=1; i<=m; i++) { fin>>a[i]; if(a[i]%2==0)ok=1; } for(i=1; i<=n; i++) { fin>>b[i]; ok=1; } if(ok==1) { i=m; j=n; while(i>=1&&j>=1) { while(b[j]%2!=0) j—; while(a[i]%2!=0) i—; if(b[j]>a[i]) { cout<<b[j]<<’ ‘; j—; } else if(b[j]==a[i]) { cout<<b[j]<<’ ‘; j—; i—; } else { cout<<a[i]<<’ ‘; i—; } } while(i>=1) { if(a[i]%2==0) cout<<a[i]<<’ ‘; i—; }

while(j>=1) { if(b[j]%2==0) cout<<b[j]<<’ ‘; } }

else cout<<“nu exista”; return 0; }


753 afișări Filip Adela (filip_adela) 20.03.2020 www.pbinfo.ro