【NOIP2005】【Luogu1051】谁拿了最多奖学金

problem

solution

codes

//模拟即可
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct node{
    int id;  string name;
    int end, peace, paper;//期末平均成绩,班级评议成绩,发表的论文数
    char cadre, west;//是否是学生干部,是否是西部省份学生
    int ans;
    bool operator < (const node &x)const{
        return ans==x.ans ? id<x.id : ans>x.ans;
    }
}a[110];
int tot;
int main(){
    int n;  cin>>n;
    for(int i = 1; i <= n; i++){
        a[i].id = i;
        cin>>a[i].name>>a[i].end>>a[i].peace>>a[i].cadre>>a[i].west>>a[i].paper;
        if(a[i].end>80 && a[i].paper>=1)a[i].ans += 8000;
        if(a[i].end>85 && a[i].peace>80)a[i].ans += 4000;
        if(a[i].end>90)a[i].ans += 2000;
        if(a[i].west=='Y' && a[i].end>85)a[i].ans += 1000;
        if(a[i].peace>80 && a[i].cadre=='Y')a[i].ans += 850;
        tot += a[i].ans;
    }
    sort(a+1,a+n+1);
    cout<<a[1].name<<"\n"<<a[1].ans<<"\n"<<tot<<"\n";
    return 0;
} 
posted @ 2018-05-25 13:22  gwj1139177410  阅读(144)  评论(0编辑  收藏  举报
选择