哪位大佬帮我看看,9个AC,1个WA

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct student
{
char name[40];
int ac_grade;
int cla_grade;
char isleader;
char iswest;
int papnum;
int money;
void cal();
};
void student::cal()
{
int money1=0;
if(ac_grade>80&&papnum>=1)
money1+=8000;
if(ac_grade>85&&cla_grade>80)
money1+=4000;
if(ac_grade>90)
money1+=2000;
if(ac_grade>85&&iswest=='Y')
money1+=1000;
if(cla_grade>80&&isleader=='Y')
money1+=850;
money=money1;
}
bool compare(const struct student &a,const struct student &b)
{
return a.money>b.money;
}
int main()
{
vector<struct student>stu;
struct student m;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>m.name>>m.ac_grade>>m.cla_grade>>m.isleader>>m.iswest>>m.papnum;
m.cal();
stu.push_back(m);
}
sort(stu.begin(),stu.end(),compare);
cout<<stu[0].name<<endl<<stu[0].money<<endl;
int sum=0;
for(int i=0;i<n;i++)
sum+=stu[i].money;
cout<<sum<<endl;
}
return 0;
}

0 条评论

目前还没有评论...

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
29555
已通过
10071
通过率
34%
上传者