fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int x=0,y=0,i,j,n,a[10001],max=-1,s;
  7. cin>>n;
  8. for(i=0;i<n;i++)
  9. cin>>a[i];
  10. for (i=0;i<n-1;i++)
  11. for(j=i+1;j<n;j++)
  12. if((a[i]+a[j])>max && ((abs(a[i]-a[j]))%2==0) && (a[i]%19==0 || a[j]%19==0))
  13. {
  14. max=a[i]+a[j];
  15. x=a[i];
  16. y=a[j];
  17. }
  18. cout<<x<<" "<<y;
  19. return 0;
  20. }
Success #stdin #stdout 0s 4524KB
stdin
5
31
12
51
16
5
stdout
0 0