为什么倒数第二个点wa

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=105;

struct ty{
char name[25];
int ave;
int py;
bool gb=false;
bool xb=false;
int lw;
int money=0;
bool operator <(const ty b)const{
if(money==b.money){
int len=min(strlen(name),strlen(b.name));
for(int i=0;i<len;i++){
if(name[i]!=b.name[i])
return name[i]<b.name[i];
}
return strlen(name)<strlen(b.name);
}
return money>b.money;
}
}student[maxn],yx;

int sum=0;

void judge(ty &a){
if(a.ave>80&&a.lw>=1)
a.money+=8000;
if(a.ave>85&&a.py>80)
a.money+=4000;
if(a.ave>90)
a.money+=2000;
if(a.ave>85&&a.xb)
a.money+=1000;
if(a.py>80&&a.gb)
a.money+=850;

sum+=a.money;
return ;
}

int main() {
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%s%d%d",student[i].name,&student[i].ave,&student[i].py);
getchar();
if(getchar()=='Y')
student[i].gb=true;
getchar();
if(getchar()=='Y')
student[i].xb=true;
scanf("%d",&student[i].lw);
judge(student[i]);
}
sort(student,student+n);
printf("%s\n%d\n%d\n",student[0].name,student[0].money,sum);
return 0;
}

0 条评论

目前还没有评论...

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39063
已通过
12711
通过率
33%
被复制
121
上传者