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=0;
  10. poz=0;
  11. for (int i=1;i<=n;i++)
  12. if (x[i]>0 && max<x[i])
  13. {max=x[i];
  14. poz=i;}
  15. cout<<max<<" "<<poz<<endl;
  16. return 0;}
Success #stdin #stdout 0.01s 5284KB
stdin
5
48 30 -20 10 6
stdout
48 1