Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream cin("input.txt");
- short n;
- cin>>n;
- long c[n];
- long mx=-1000000, mx2=-1000001;
- for (short i = 0; i<n; i++)
- {
- cin>>c[i];
- mx = max(c[i], mx);
- }
- bool f = false;
- for (short i = 0; i<n; i++)
- if (c[i]== mx)
- if(!f)
- f = true;
- else
- mx2 = max(c[i], mx2);
- else
- mx2 = max(c[i], mx2);
- cout<<mx2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement