- 谁拿了最多奖学金
- @ 2015-09-22 23:44:35
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
struct cirno
{
    string name;
    int final,class1,paper;
    bool ganbu,western;
};
template<class out_type,class in_value>
out_type convert(const in_value & t)
{
    stringstream stream;
    stream<<t;
    out_type result;
    stream>>result;
    return result;
}
int main(){
    cirno a[100];
    int n;
    int i;
    string t;
    getline(cin,t);
    n=convert<int>(t);
    string t1,t2,t3,t4,t5,t6;
    string temp;
    for (i=1;i<=n;i++){
        getline(cin,temp);
        istringstream is(temp);
        is>>t1>>t2>>t3>>t4>>t5>>t6;
a[i].name=t1;
        a[i].final=convert<int>(t2);
        a[i].class1=convert<int>(t3);
        a[i].ganbu = (t4=="Y");
        a[i].western = (t5 == "Y");
        a[i].paper=convert<int>(t6);
}
      int money=0;
    int maxmoney=0;
    int total=0;
    string maxmoneyman="";
    for (i=1;i<=n;i++){
        money=0;
        if (a[i].final>80&&a[i].paper>=1)money=money+8000;
        if (a[i].final>85&&a[i].class1>80)money=money+4000;
        if (a[i].final>90)money=money+2000;
        if (a[i].final>85&&a[i].western)money=money+1000;
        if (a[i].class1>80&&a[i].ganbu)money=money+850;
        if (money>maxmoney){
            maxmoney=money;
            maxmoneyman=a[i].name;
        }
        total=total+money;
    }
    cout<<maxmoneyman<<endl<<maxmoney<<endl<<total<<endl;
    return 0;
}
1 条评论
- 
  LBtresha LV 7 @ 2015-09-29 00:07:34编译是-o0的,c++这些库不优化很占空间又慢,爆栈了 
- 1