Varianta 55 / Subiectul 3 / Problema 4 |
#include<iostream.h> int putere(int n) { int p=1; while(n) { p=p*10; n=n/10; } return p; } void main() { int n, a[100],b[100]; long c[100]; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) cin>>b[i]; for(i=1;i<=n;i++) if(a[i]<b[i]) c[i]=(long)a[i]*putere(b[i])+b[i]; else c[i]=(long)b[i]*putere(a[i])+a[i]; for(i=1;i<=n;i++) cout<<c[i]<<" "; } |