0分求助!!
查看原帖
0分求助!!
977778
__Harry_Haiyun__楼主2023/7/18 11:39

怎么就不行了嘞……

#include <bits/stdc++.h>
#define MOD 998244353
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define range(i,a,b) for (int i = a; i <= b; i++)
using namespace std;
struct student
{
    string name;
    int exam;
    int classexam;
    char classman;
    char west;
    int article;
    int money = 0;
}stu[105];
int main()
{
	int n,i,j,sum = 0;
	cin >> n;
	range(i,0,n - 1)
	{
	    cin >> stu[i].name >> stu[i].exam >> stu[i].classman >> stu[i].west >> stu[i].article;
	    if (stu[i].exam > 80 && stu[i].article >= 1) stu[i].money += 8000;
	    if (stu[i].exam > 85 && stu[i].classexam > 80) stu[i].money += 4000;
	    if (stu[i].exam > 90) stu[i].money += 2000;
	    if (stu[i].exam > 85 && stu[i].west == 'Y') stu[i].money += 1000;
	    if (stu[i].classexam > 80 && stu[i].classman == 'Y') stu[i].money += 850;
	    sum += stu[i].money;
    }
    range(i,0,n - 1)
    {
        range(j,0,n - 1)
        {
            if (stu[j].money < stu[j + 1].money) 
            {
                swap(stu[j].money,stu[j + 1].money);
                swap(stu[j].name,stu[j + 1].name);
            }
        }
    }
    cout << stu[0].name << endl;
    cout << stu[0].money << endl;
    cout << sum << endl;
	return 0;
}
2023/7/18 11:39
加载中...