提交时间:2023-10-11 13:34:10

运行 ID: 106374

#include<bits/stdc++.h> using namespace std; int n; long long int chazhi,daan = LLONG_MIN,minn; int main() { cin >> n >> minn; for (int i = 2;i <= n;i++){ cin >> chazhi; if (chazhi - minn > daan) daan = chazhi - minn; if (chazhi < minn) minn = chazhi; } cout << daan; return 0; }