Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long long int tab[1000005];
- int main()
- {
- ios_base::sync_with_stdio(0);
- int k, n, w=0;
- cin>>k;
- for(int i=0; i<k; i++)
- {
- cin>>tab[i];
- }
- sort(tab, tab+k);
- for(int i=0; i<k; i++)
- {
- if(tab[i]>2*w)
- {
- w=tab[i]-w;
- }
- }
- cout<<w<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement