| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 150622 | 陈彦霖 | 最大值与最小值的差 | C++ | Accepted | 1 MS | 272 KB | 379 | 2026-03-29 12:54:14 |
#include <bits/stdc++.h> using namespace std; int main() { int m; cin >> m; int a[m]; for (int i = 0; i < m; i++) { cin >> a[i]; } int x, y; x = 0; y = 0; for (int i = 1; i < m; i++) { if (a[i] >= a[x]) { x = i; } } for (int i = 1; i < m; i++) { if (a[i] <= a[y]) { y = i; } } cout << a[x] - a[y]; return 0; }