1 条题解

  • 0
    @ 2024-11-24 12:00:41

    #include<bits/stdc++.h> using namespace std; typedef struct Student { string name; int averageScore; int classScore; char isCadre; char isWestern; int paperCount; int scholarshipAmount = 0; } Stu; int main() { int Max = 0; Stu stus[200]; int n; cin >> n; for (int i = 1; i <= n; i++) {

    	cin >> stus[i].name >> stus[i].averageScore >> stus[i].classScore >> stus[i].isCadre >> stus[i].isWestern >> stus[i].paperCount;
    }
    string Maxname;
    int Cnt = 0;
    for (int i = 1; i <= n; i++) {
    	if (stus[i].averageScore > 80 && stus[i].paperCount >= 1) {
    		stus[i].scholarshipAmount += 8000;
    	}
    	if (stus[i].averageScore > 85 && stus[i].classScore > 80) {
    		stus[i].scholarshipAmount += 4000;
    	}
    	if (stus[i].averageScore > 90 ) {
    		stus[i].scholarshipAmount += 2000;
    	}
    	if (stus[i].averageScore > 85 && stus[i].isWestern == 'Y') {
    		stus[i].scholarshipAmount += 1000;
    	}
    	if (stus[i].classScore > 80 && stus[i].isCadre == 'Y') {
    		stus[i].scholarshipAmount += 850;
    	}
    	if (stus[i].scholarshipAmount > Max) {
    		Max = stus[i].scholarshipAmount;
    		Maxname = stus[i].name;
    	}
    	Cnt += stus[i].scholarshipAmount;
    }
    cout<<Maxname<<endl<<Max<<endl<<Cnt;
    return 0;
    

    }

    信息

    ID
    683
    时间
    1000ms
    内存
    125MiB
    难度
    10
    标签
    递交数
    5
    已通过
    2
    上传者