笔盖大失


私信TA

用户名:Singer500

访问量:3386

签 名:

我的笔盖呢?

等  级
排  名 1071
经  验 3125
参赛次数 2
文章发表 17
年  龄 21
在职情况 学生
学  校
专  业 软件工程

  自我简介:

解题思路:

注意事项:

参考代码:

#include<bits/stdc++.h>
using namespace std;
struct student
{
    char no[50];
    string na[50];
    int ach [50][50];

};
int ave(student *ach,int n,int j);
int main()
{
    int n,sum=0,max=0,id;
    cin>>n;
    student stu;
    for(int i=0;i<n;i++)
    {
        cin>>stu.no[i]>>stu.na[i];
        for(int j=0;j<3;j++)
        {
            cin>>stu.ach[i][j];
            sum+=stu.ach[i][j];
        }
        if(max<sum)
        {   
            max=sum;
            id=i;
        }
        sum=0;
    }
    cout<<ave(&stu,n,0)<<" "<<ave(&stu,n,1)<<" "<<ave(&stu,n,2)<<endl;
    cout<<stu.no[id]<<" "<<stu.na[id]<<" "<<stu.ach[id][0]<<" "<<stu.ach[id][1]<<" "<<stu.ach[id][2];
    return 0;
}

int ave(student *ach,int n,int j)
{
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=ach->ach[i][j];
    }
    return sum/n;
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区