Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- { long x;
- int n,z;
- cin>>n;
- long* arr = NULL;
- arr = new long[n];
- long long first_max=0;
- long long sec_max=0;
- for (int i=0; i<n; i++)
- {cin>>x;
- arr[i]=x;
- if(arr[i]>first_max)
- {
- first_max=arr[i];
- z=i;
- }
- }
- for (int i=0; i<n; i++)
- {
- if(arr[i]>sec_max&&i!=z)
- sec_max=arr[i];
- }
- cout<<sec_max*first_max<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement