实在是找不出bug 这题卡了三天了,要不是luogu说今天易做已WA的题我就放了。。。。
#include<bits/stdc++.h>
using namespace std;
long long n,scholarshipALL = 0,v = 0;
long long scholarshipMAX;
struct Student{
string name;//名字
long long grades;//期末成绩
long long classgrades;//班级评议成绩
char studentLeader;//是否是学生干部
char west;//是否是西部学生
long long paperNumber;//发论文数
long long scholarship;//奖学金数
long long a;//出现最早
Student(){
scholarship = 0;
}
};
Student student[100 + 5];
void GetScholarshipFA()
{
for(int i = 1; i <= n;i++){
//先是院士奖学金
if(student[i].grades > 80 && student[i].paperNumber >= 1){
student[i].scholarship += 8000;
}
//五四
if(student[i].grades > 85 && student[i].classgrades > 80){
student[i].scholarship += 4000;
}
//成绩
if(student[i].grades > 90) student[i].scholarship += 2000;
//west
if(student[i].west == 'Y'&&student[i].grades > 85) student[i].scholarship += 1000;
//studentleader
if(student[i].classgrades > 80 && student[i].studentLeader == 'Y') student[i].scholarship += 850;
scholarshipALL += student[i].scholarship;
}
}
int GetScholarshipMAX()
{
int sum = student[1].scholarship;
for(int i = 2; i <= n;i++){
if(sum <= student[i].scholarship){
sum = student[i].scholarship;
}
}
for(int i = 1;i <= n;i++){
if(sum == student[i].scholarship)
v = i;
}
return sum;
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> student[i].name >> student[i].grades >> student[i].classgrades
>> student[i].studentLeader >> student[i].west >> student[i].paperNumber;
}
GetScholarshipFA();
int MAX = GetScholarshipMAX();
cout<<student[v].name<<endl<<MAX<<endl;
cout<<scholarshipALL<<endl;
return 0;
}