Submission
Status:
[PPPPTSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: 69DS24
Problemset: stock
Language: cpp
Time: 1.093 second
Submitted On: 2026-10-06 13:53:00
#include <iostream>
using namespace std;
int main(){
int n,x,pre=0,pro,mx=0; cin >> n;
int arr[n];
for (int i=0;i<n;i++){
cin >> x;
arr[i] = x;
}
for (int i=0;i<n-1;i++){
for (int j=i+1;j<n;j++){
int profit = arr[j]-arr[i];
if (profit>mx) mx = profit;
}
}
cout << mx;
return 0;
}