数组题解
2024-08-17 16:27:30
发布于:广东
1阅读
0回复
0点赞
#include<iostream>
using namespace std;
int main(){
int month[8][3],season[8],S_Index,mx[8]={-5,-5,-5,-5,-5,-5,-5,-5},mn[8]={105,105,105,105,105,105,105,105},Max=-5,Min=105;
for(int i=0;i<=7;i++)
for(int j=0;j<=2;j++)
cin>>month[i][j];
for(int i=0;i<=7;i++){
for(int j=0;j<=2;j++){
if(month[i][j]>=mx[i])mx[i]=month[i][j];
if(month[i][j]<=mn[i])mn[i]=month[i][j];
}
season[i]=mx[i]-mn[i];
}
for(int i=0;i<=7;i++){
if(season[i]>=Max)Max=season[i];
if(season[i]<=Min)Min=season[i];
}
S_Index=Max-Min;
cout<<S_Index;
return 0;
}
这里空空如也
有帮助,赞一个