提交时间:2023-12-16 10:04:41

运行 ID: 116293

#include<iostream> using namespace std; const int N = 1e4 + 10; int n, a[N], ans = 0; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 1; i < n; i++){ for(int j = i+1; j < n; j++){ ans = max(ans, a[j] - a[i]); } } cout << ans; return 0; }