求助:在Vijos上Runtime Error,本地正常运行。

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

pair<string, int> p[110];
int teas;
int cs; 
char vol;
char iws;
int ess;

bool cmp(pair<string, int>x, pair<string, int>y){
    return x.second < y.second;
}

int main(){
    std::ios::sync_with_stdio(0);
    // freopen("input.in", "r", stdin);
    int n;
    int result = 0;
    cin >> n;
    for (int i = 1; i <= n; i++){
        // Name
        cin >> p[i].first >> teas >> cs >> vol >> iws >> ess;
        p[i].second = 0;
        // Term-end average score
        if (teas > 90) p[i].second += 2000;
        // class score and if is volunteer
        if (cs > 80 && vol == 'Y') p[i].second += 850;
        // western student
        if (iws == 'Y' && teas > 85) p[i].second += 1000;
        // 5 4
        if (teas > 85 && cs > 80) p[i].second += 4000;
        // essay
        if (ess >= 1 && teas > 80) p[i].second += 8000;

        result += p[i].second;
    }
    sort(p+1, p+n+1, cmp);
    cout << p[n].first << endl << p[n].second << endl << result << endl;
    return 0;
}

2 条评论

  • @ 2025-07-11 22:19:36

    直接上代码

    #include<iostream>
    #include<cstring>
    using namespace std;
    int main()
    {
        int n,i,zq=0,q=0,chengji1,chengji2,lunwen=0,maxn=0,t=0,j;
        char yes=0,yes1=0;
        string name[100];
        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>name[i]>>chengji1>>chengji2>>yes>>yes1>>lunwen;
            q=0;
            if(chengji1>80&&lunwen>0)
            {
                zq+=8000;
                q+=8000;
            }
            if(chengji1>85&&chengji2>80)
            {
                zq+=4000;
                q+=4000;
            }
            if(chengji1>90)
            {
                zq+=2000;
                q+=2000;
            }
            if(chengji1>85&&yes1=='Y')
            {
                zq+=1000;
                q+=1000;
            }
            if(chengji2>80&&yes=='Y')
            {
                zq+=850;
                q+=850;
            }
            if(q>maxn)
            {
                maxn=q;
                t=i;
            }
        }
        cout<<name[t]<<"\n"<<maxn<<"\n"<<zq;
        return 0;
    }
    
  • @ 2024-08-05 11:53:49

    第一眼:卧槽,gpt,作弊

    第二眼:好像,貌似还真是自己写的

  • 1

信息

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