- 问答
- 2013-08-19 16:49:21 @
样例过了没问题..
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <fstream>
using namespace std;
struct student{
string name;
int sc1;
int sc2;
char cad;
char west;
int the;
};
struct student stu[101];
int i,l,m,n,maxM,temp,sum=0;
int money[101]={0};
int main(int argc, char *argv[]) {
cin>>n;
for(i=1;i<=n;i++){
cin>>stu[i].name;
cin>>stu[i].sc1;
cin>>stu[i].sc2;
cin>>stu[i].cad;
cin>>stu[i].west;
cin>>stu[i].the;
if ((stu[i].sc1>=80) and (stu[i].the>=1)){
money[i]=money[i]+8000;
}
if ((stu[i].sc1>=85) and (stu[i].sc2>=80)){
money[i]=money[i]+4000;
}
if (stu[i].sc1>=90){
money[i]=money[i]+2000;
}
if ((stu[i].sc1>=85) and (stu[i].west == 'Y')){
money[i]=money[i]+1000;
}
if ((stu[i].sc1>=80) and (stu[i].cad == 'Y')){
money[i]=money[i]+850;
}
if (money[i]>maxM){
temp=i;
maxM=money[i];
}
sum=sum+money[i];
}
cout<<stu[temp].name<<endl;
cout<<maxM<<endl;
cout<<sum;
}
2 条评论
-
华好少年 LV 8 @ 2013-08-25 14:06:23
sto LZ orz
-
2013-08-20 18:10:37@
= =
- 1