1 2 3 4 5 6 7 8 9 10 11 12
| #include<bits/stdc++.h> using namespace std; int n,m,a[105],b[105]; bool s[505]; int main(){ scanf("%d",&n); for (int i=1;i<=n;i++)scanf("%d",&a[i]),s[a[i]]=1; scanf("%d",&m); for (int i=1;i<=m;i++)scanf("%d",&b[i]),s[b[i]]=1; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++)if(!s[a[i]+b[j]])return !printf("%d %d",a[i],b[j]); }
|