fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n,x[1001];
  5. cin>>n;
  6. for (int i=1;i<=n;i++)
  7. cin>>x[i];
  8. int max,poz;
  9. max=-1000;
  10. poz=0;
  11. for (int i=1;i<=n;i++)
  12. if (x[i]%2==0 && max<x[i])
  13. {max=x[i];
  14. poz=i;}
  15. cout<<max<<" "<<poz<<endl;
  16. return 0;}
Success #stdin #stdout 0.01s 5280KB
stdin
3
20 -10 5
stdout
20 1