Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n;
- scanf("%d",&n);
- long long int profit = -99999999999, max = 999999999999;
- for(int i=0;i<n;i++){
- long long int x;
- scanf("%lld",&x);
- if(x-max > profit)
- profit = x-max;
- if(max > x)
- max = x;
- }
- printf("%lld\n",profit);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement