2 条题解

  • 0
    @ 2025-10-9 17:43:23
    #include<stdio.h>
    #include<string.h>
    struct student
    {
        char name[100];
        int finalscore;//期末成绩
        int classscore;//班级评价成绩
        char is_cadre;//干部,太想进步了
        char is_west;//西部省份
        int papers;//论文
        int total;//总奖金
    };
    int main()
    {
        int n,x;//n组,整数x
        scanf("%d",&n);
    for(int k=0;k<n;k++)
    {
        scanf("%d",&x);
    struct student student[x];//学生总数x个
    int all=0;//x个学生总和
    int max=0;//最能拿的学生
    for(int i=0;i<x;i++)//判定X个
    {
        scanf(" %s %d %d %c %c %d",
        student[i].name,
        &student[i].finalscore,
        &student[i].classscore,
        &student[i].is_cadre,
        &student[i].is_west,
        &student[i].papers);//录入数据完毕
        student[i].total = 0;
    if(student[i].papers>=1&&student[i].finalscore>80)
    {student[i].total+=8000;}
    if(student[i].finalscore>85&&student[i].classscore>80)
    {student[i].total+=4000;}
    if(student[i].finalscore>90)
    {student[i].total+=2000;}
    if(student[i].is_west == 'Y'&&student[i].finalscore>85)
    {student[i].total+=1000;}
    if(student[i].is_cadre == 'Y'&&student[i].classscore>80)
    {student[i].total+=850;}
    all +=student[i].total;//all是所有人的综合,total是单个人的拿到手的
    //开始找最优秀的那个货
    if(student[i].total>student[max].total)
    {
       max=i;
    }
    }
    printf("%s\n",student[max].name);
    printf("%d\n",student[max].total);
    printf("%d\n",all);
    }
    return 0;
    }
    

    信息

    ID
    141
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    (无)
    递交数
    1380
    已通过
    217
    上传者