- 谁拿了最多奖学金
- 2016-12-11 10:40:30 @
#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 条评论
-
刘锦钰是超神.. LV 8 @ 2016-12-11 19:46:40
这个还好
- 1