| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 116988 | 梁乃元 | 买卖股票的最佳时机 | C++ | Accepted | 100 | 0 MS | 256 KB | 396 | 2023-12-21 13:34:58 |
# include <bits/stdc++.h> using namespace std ; int c [114514] ; int main ( ) { int a , e = 0 ; cin >> a ; for ( int i = 1 ; i <= a ; i ++ ) { cin >> c [i] ; } for ( int i = 1 ; i <= a ; i ++ ) { for ( int j = i + 1 ; j <= a ; j ++ ) { if ( c [j] > c [i] ) { e = e >= c [j] - c [i] ? e : c [j] - c [i] ; } } } cout << e << endl ; return 0 ; }