really water

#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<ctime>
#include<cstring>
#include<cassert>
#include<bitset>
#include<sstream>
#include<queue>
#include<stack>
#include<utility>
#include<deque>
#include<functional>
#include<cstdlib>
using namespace std;

struct student
{
    string name;
    int selfpoint,classpoint;
    string classgb,xbxx;
    int lws;
};

student a[100];

struct money
{
    string name;
    int studymoney;
};

int jxj(int i)
{
    int s=0;
    if(a[i].selfpoint>80&&a[i].lws>=1) s+=8000;
    if(a[i].selfpoint>85&&a[i].classpoint>80) s+=4000;
    if(a[i].selfpoint>90) s+=2000;
    if(a[i].selfpoint>85&&a[i].xbxx=="Y") s+=1000;
    if(a[i].classpoint>80&&a[i].classgb=="Y") s+=850;
    return s;
}

int main()
{
    int s,h=0;
    cin>>s;
    money b[s];
    for(int i=0;i<s;i++)
    {
        cin>>a[i].name>>a[i].selfpoint>>a[i].classpoint>>a[i].classgb>>a[i].xbxx>>a[i].lws;
        b[i].studymoney=jxj(i);
        b[i].name=a[i].name;
    }
    
//  for(int i=0;i<s;i++)
//      cout<<b[i].name<<" "<<b[i].studymoney<<endl;
//  cout<<endl;
    
    for(int i=0;i<s;i++)
        for(int j=i+1;j<s;j++)
            if(b[i].studymoney<b[j].studymoney)
            {
                int t=0;
                t=b[i].studymoney;
                b[i].studymoney=b[j].studymoney;
                b[j].studymoney=t;
                
                string tname=" ";
                tname=b[i].name;
                b[i].name=b[j].name;
                b[j].name=t;
            }
//  for(int i=0;i<s;i++)
//      cout<<b[i].name<<" "<<b[i].studymoney<<endl;
    
    for(int i=0;i<s;i++)
        h+=b[i].studymoney;
    
    cout<<b[0].name<<endl;
    cout<<b[0].studymoney<<endl;
    cout<<h;
    return 0;
}

1 条评论

  • 1

信息

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