各位dalao来看一下 30分求助

P1093 [NOIP2007 普及组] 奖学金

Williamyuan @ 2019-01-30 21:46:32

// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
struct stu1{
    string name;
    int latest;
    int Class;
    char Is_cadres;
    char Is_Westen;
    int textnum;
    int money=0;    
    int id;
};
stu1 stu[100];
bool cmp(stu1 x,stu1 y)
{
    if(x.money==y.money) return x.id<y.id;
    return x.money>y.money; 
}
int main(){
    int n,allmoney=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin>>stu[i].name>>stu[i].latest>>stu[i].Class>>stu[i].Is_cadres>>stu[i].Is_Westen>>stu[i].textnum;
        stu[i].id=i+1;
        if(stu[i].latest>80 && stu[i].textnum>=1) stu[i].money+=8000;
        if(stu[i].latest>85 && stu[i].Class>80) stu[i].money+=4000;
        if(stu[i].latest>90) stu[i].money+=2000;
        if(stu[i].latest>85 && stu[i].Is_Westen=='Y') stu[i].money+=1000;
        if(stu[i].latest>80 && stu[i].Is_cadres=='Y') stu[i].money+=850;
        allmoney+=stu[i].money;
    }
    sort(stu,stu+n,cmp);
    cout<<stu[0].name<<endl<<stu[0].money<<endl<<allmoney<<endl;
    return 0;
}

2,3,6,7,9,10 WA

说是总钱数的问题??? 怎么办 求助dalao


by Williamyuan @ 2019-01-30 21:56:58

抱歉,发错了


|