ResonCaolol @ 2023-05-21 13:49:06
#include<bits/stdc++.h>
using namespace std;
int sum[1001];
int maxx;
struct student{
string name;
int eng;
int chi;
int mat;
}q[1001];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q[i].name>>q[i].chi>>q[i].mat>>q[i].eng;
sum[i]=q[i].chi+q[i].eng+q[i].mat;
max(maxx,sum[i]);
}
for(int i=0;i>n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<<q[i].chi<<q[i].mat<<q[i].eng;
}
return 0;
}
by ZZQF5677 @ 2023-05-21 13:50:05
for(int i=0;i>n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<<q[i].chi<<q[i].mat<<q[i].eng;
}
改为
for(int i=0;i<n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<<q[i].chi<<q[i].mat<<q[i].eng;
}
by ZZQF5677 @ 2023-05-21 13:50:20
@1125__qwq
by 2huk @ 2023-05-21 13:50:21
for(int i=0;i>n;i++)
应改成
for(int i=0;i<n;i++)
by ResonCaolol @ 2023-05-21 13:54:48
改了,还是无输出
#include<bits/stdc++.h>
using namespace std;
int sum[1001];
int maxx;
struct student{
string name;
int eng;
int chi;
int mat;
}q[1001];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q[i].name>>q[i].chi>>q[i].mat>>q[i].eng;
sum[i]=q[i].chi+q[i].eng+q[i].mat;
max(maxx,sum[i]);
}
for(int i=0;i<n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<<q[i].chi<<q[i].mat<<q[i].eng;
}
return 0;
}
by mcr123456 @ 2023-05-21 14:22:37
#include<点个关注吧>
using namespace std;
int sum[关注吧];
int maxx;
struct student{
string name;
int eng;
int chi;
int mat;
}q[1001];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q[i].name>>q[i].chi>>q[i].mat>>q[i].eng;
sum[i]=q[i].chi+q[i].eng+q[i].mat;
maxx=max(maxx,sum[i]);
}
for(int i=0;i<n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<<" "<<q[i].chi<<" "<<q[i].mat<<" "<<q[i].eng<<endl;
}
return 0;
}
by ZZQF5677 @ 2023-05-21 14:24:09
@1125__qwq
ok了。
#include<bits/stdc++.h>
using namespace std;
int sum[1001];
int maxx;
struct student{
string name;
int eng;
int chi;
int mat;
}q[1001];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q[i].name>>q[i].chi>>q[i].mat>>q[i].eng;
sum[i]=q[i].chi+q[i].eng+q[i].mat;
maxx=max(maxx,sum[i]);
}
for(int i=0;i<n;i++)
{
if(sum[i]==maxx) cout<<q[i].name<< " " << q[i].chi<< " "<<q[i].mat<< " "<<q[i].eng<<"\n";
}
return 0;
}