Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
116699 | 糜宗易 | 最大值与最小值的差 | C++ | Accepted | 1 MS | 272 KB | 295 | 2025-04-12 12:48:01 |
#include<iostream> using namespace std; int main() { int n; cin >> n; int b[n], d = 0, e = 10000; for (int i = 0; i < n; i++){ cin >> b[i]; } int c=0; for (int c = 0; c < n; c++){ if (b[c] > d) d = b[c]; if (b[c] < e) e = b[c]; } cout << d - e; return 0; }