C++题解
2024-08-03 10:19:32
发布于:四川
11阅读
0回复
0点赞
AC代码
#include <iostream>
#include <algorithm>
using namespace std;
int a[100005];
int main(){
for(int i = 1; i <= 24; i++){
cin >> a[i];
}
int mx = -2147483648, mn = 2147483647;//int的极限
for (int i = 1; i <= 24; i += 3){
int ct = max(a[i], max(a[i + 1], a[i + 2])) - min(a[i], min(a[i + 1], a[i + 2]));
mx = max(mx, ct);
mn = min(mn, ct);
}
cout << mx - mn;
return 0;
}
这里空空如也
有帮助,赞一个