八季之殇
2023-07-19 10:59:42
发布于:上海
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("season.in","r",stdin);
freopen("season.out","w",stdout);
int a[4],b[4],c[4],d[4],e[4],f[4],g[4],h[4];
int n[9];
for(int i=0;i<24;i++)
{
if(i<3)
{
cin >> a[i];
continue;
}
else if(i<6)
{
cin >> b[i-3];
continue;
}
else if(i<9)
{
cin >> c[i-6];
continue;
}
else if(i<12)
{
cin >> d[i-9];
continue;
}
else if(i<15)
{
cin >> e[i-12];
continue;
}
else if(i<18)
{
cin >> f[i-15];
continue;
}
else if(i<21)
{
cin >> g[i-18];
continue;
}
else
{
cin >> h[i-21];
continue;
}
}
for(int i=0;i<8;i++){
if(i==0) n[0] = max(a[0],max(a[1],a[2]))-min(a[0],min(a[1],a[2]));
if(i==1) n[1] = max(b[0],max(b[1],b[2]))-min(b[0],min(b[1],b[2]));
if(i==2) n[2] = max(c[0],max(c[1],c[2]))-min(c[0],min(c[1],c[2]));
if(i==3) n[3] = max(d[0],max(d[1],d[2]))-min(d[0],min(d[1],d[2]));
if(i==4) n[4] = max(e[0],max(e[1],e[2]))-min(e[0],min(e[1],e[2]));
if(i==5) n[5] = max(f[0],max(f[1],f[2]))-min(f[0],min(f[1],f[2]));
if(i==6) n[6] = max(g[0],max(g[1],g[2]))-min(g[0],min(g[1],g[2]));
if(i==7) n[7] = max(h[0],max(h[1],h[2]))-min(h[0],min(h[1],h[2]));
}
int max=-1,min=1002;
for(int i=0;i<8;i++)
{
if(n[i]>max)
{
max=n[i];
}
if(n[i]<min)
{
min=n[i];
}
}
cout << max-min;
fclose(stdin);
fclose(stdout);
return 0;
}
全部评论 1
哇!谢谢大佬
2023-07-19 来自 浙江
0
有帮助,赞一个