aimon1337

Untitled

Apr 20th, 2021 (edited)
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. int n; cin>>n;
  2.     int v1, v2, v3;
  3.     int i;
  4.     int x;
  5.     v1=-1;
  6.     v2=-1;
  7.     v3=-1;
  8.     for(i=1; i<=n/2; ++i){
  9.         cin>>x;
  10.         if(v2<x){
  11.             v1=v2;
  12.             v2=x;
  13.         }
  14.        
  15.     }
  16.     cin>>v3;
  17.     if(v2<v3){
  18.         cout<<v2;
  19.     }else
  20.     if(v2==v3 && v1<v2 && v1!=(-1))
  21.         cout<<v1;
  22.     else if(v1==(-1))  cout<<"Nu exista";
Add Comment
Please, Sign In to add comment