tyvj p1002- 谁拿了最多奖学金[模拟]

#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
using namespace std;
struct stu
{
    string name;
    int no;
    int score, score_2, paper, money = 0;
    char leader, western;
}student[105];

bool cmp(const stu &s1, const stu &s2)
{
    if(s1.money == s2.money)
        return s1.no < s2.no;
    else
        return s1.money > s2.money;
}

int main()
{
    int n;
    scanf("%d", &n);
    long long sum = 0;

    for(int i = 1; i <= n; ++i)
    {
        cin >> student[i].name >> student[i].score >> student[i].score_2 >> student[i].leader >> student[i].western >> student[i].paper;
        student[i].no = i;
        if(student[i].paper >= 1 && student[i].score > 80)
            student[i].money += 8000;
        if(student[i].score > 85 && student[i].score_2 > 80)
            student[i].money += 4000;
        if(student[i].score > 90)
            student[i].money += 2000;
        if(student[i].score > 85 && student[i].western == 'Y')
            student[i].money += 1000;
        if(student[i].score_2 > 80 && student[i].leader == 'Y')
            student[i].money += 850;
    }
    for(int i = 1; i <= n; ++i)
        sum += student[i].money;
    sort(student+1, student+1+n, cmp);
    /*int maxn = 0, number;
    for(int i = 1; i <= n; ++i)
    {
        if(student[i].money > maxn)
        {
            maxn = student[i].money;
            number = i;
        }
    }
     */
    cout << student[1].name << endl;
    cout << student[1].money << endl;
    cout << sum << endl;
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值