在本地ide编译没问题,为什么在洛谷上交的时候编译失败
查看原帖
在本地ide编译没问题,为什么在洛谷上交的时候编译失败
1215394
Limerence559楼主2023/12/16 18:14
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int,string> PIS;
const int N=110;
vector<PIS> peo;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        string s;cin>>s;
        int last,qimo,lun;cin>>last>>qimo;
        char b[2],x[2];scanf("%s%s",b,x);
        cin>>lun;
        int sum=0;
        if(last>=80 && lun>=1) sum+=8000;
        if(last>=85 && qimo>=80) sum+=4000;
        if(last>=90) sum+=2000;
        if(last>=85 && *x=='Y') sum+=1000;
        if(qimo>=80 && *b=='Y') sum+=850;
        peo.push_back({sum,s});
    }
    int res=0;
    sort(peo.begin(),peo.end());

    auto student=peo.end()-1;
    string ress;
    bool flag=0;
    for(auto &stu:peo)
    {
        res+=stu.first;
        if(stu.first>=student->first && !flag)
        {
            ress=stu.second;
            flag=1;
        }
    }
    cout<<student->first<<endl<<ress<<endl;
    cout<<res<<endl;
    return 0;
}

2023/12/16 18:14
加载中...