- 谁拿了最多奖学金
- 2015-07-15 18:12:37 @
编译器能过,但提交错误>.<
#include "iostream"
#include "string"
using namespace std;
struct Y{
string name;
int qimo;
int banji;
char bangan;
char xibu;
int lunwen;
int jiangxuejin;
};
Y a[100000];
int cmp(Y x, Y y)
{
return x.jiangxuejin>y.jiangxuejin;
}
int main()
{
int n,zjj=0;
cin>>n;
for(int i=0;i<n;i++)
a[i].jiangxuejin=0;
for(int i=0;i<n;i++){
cin>>a[i].name>>a[i].qimo>>a[i].banji>>a[i].bangan>>a[i].xibu>>a[i].lunwen;
if(a[i].qimo>80 && a[i].lunwen>=1)
a[i].jiangxuejin+=8000;
if(a[i].qimo>85 && a[i].banji>80)
a[i].jiangxuejin+=4000;
if(a[i].qimo>90 )
a[i].jiangxuejin+=2000;
if(a[i].qimo>85 && a[i].xibu=='Y')
a[i].jiangxuejin+=1000;
if(a[i].banji>80 && a[i].bangan=='Y')
a[i].jiangxuejin+=850;
}
sort(a,a+n,cmp);
for(int i=0;i<n;i++)
{
zjj+=a[i].jiangxuejin;
}
cout<<a[0].name<<endl<<a[0].jiangxuejin<<endl<<zjj;
return 0;
}
1 条评论
-
twd2 LV 9 MOD @ 2015-07-15 20:32:36
蒟蒻路过......
你可能需要include一下algorithm
- 1