not_exist @ 2022-08-17 17:32:26
#include<bits/stdc++.h>
using namespace std;
typedef string sg;
int main()
{
int n;
cin>>n;
sg x,maxx;
int a,b,c,max[3];
memset(max,INT_MIN+100000,sizeof(max));
for(int i=0;i<n;i++){
cin>>x>>a>>b>>c;
if(a+b+c>max[0]+max[1]+max[2]){
max[0]=a;
max[1]=b;
max[2]=c;
maxx=x;
}
}
cout<<maxx<<" "<<max[0]<<" "<<max[1]<<" "<<max[2];
return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef string sg;
int main()
{
int n;
cin>>n;
sg x,maxx;
int a,b,c,max[3];
memset(max,INT_MIN,sizeof(max));
for(int i=0;i<n;i++){
cin>>x>>a>>b>>c;
if(a+b+c>max[0]+max[1]+max[2]){
max[0]=a;
max[1]=b;
max[2]=c;
maxx=x;
}
}
cout<<maxx<<" "<<max[0]<<" "<<max[1]<<" "<<max[2];
return 0;
}
by not_exist @ 2022-08-17 17:32:57
有大佬能给一个合理的解释吗
by IGJHL @ 2022-08-17 17:41:31
原来 memset
还能把初始化的值设为这种数
by IGJHL @ 2022-08-17 17:42:55
提个建议,数组名最好别用 max
这种函数关键字,再加上你开了万能头,能
by not_exist @ 2022-08-18 12:53:37
知道了,谢谢
by not_exist @ 2022-08-18 13:02:24
@OI_Loser_IGJHL 其实,我以前只要有关最大/最小的变量都叫max/min,基本能过
by IGJHL @ 2022-08-18 13:39:48
@300396ye 换€€£的评测鸡应该就寄了(?)
by not_exist @ 2022-08-18 13:47:08
@OI_Loser_IGJHL €€£是什么???
by IGJHL @ 2022-08-18 14:07:40
@300396ye CCF
by not_exist @ 2022-08-18 14:32:18
哦