NYOJ 60谁获得了最高奖学金

原题目链接

判断每种情况的获得奖金就行,水一下~

#include 
#include 
using namespace std;

struct student
{
    string name;
    int argEnd;
    int argCls;
    char isLeader;
    char isWester;
    int num;

    int getAward()
    {
        int res = 0;
        if(argEnd>80 && num>=1)
            res+=8000;
        if(argEnd>85 && argCls>80)
            res+=4000;
        if(argEnd>90)
            res+=2000;
        if(argEnd>85 && isWester=='Y')
            res+=1000;
        if(argCls>80 && isLeader=='Y')
            res+=850;

        return res;
    }
};

int main()
{
    student stu[110];
    int t,n;
    int res,all,maxid;

    cin>>t;

    while(t--){
        cin>>n;
        res=all=maxid=0;
        for(int i=0;i>stu[i].name>>stu[i].argEnd>>stu[i].argCls>>stu[i].isLeader>>stu[i].isWester>>stu[i].num;
            int price = stu[i].getAward();
            if(price>res){
                maxid = i;
                res = price;
            }
            all+=price;
        }
        cout<


你可能感兴趣的:(算法)