fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b,max1=0,max2=0;
  6. cin>>a;
  7. for(int i=0;i<a;i++)
  8. {
  9. cin>>b;
  10. if(max1<b)
  11. {
  12. max2=max1;
  13. max1=b;
  14. }
  15. else if(max2<b)
  16. {
  17. max2=b;
  18. }
  19. }
  20. cout<<max2;
  21. return 0;
  22. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty