题解 | 最厉害的学生

最厉害的学生

https://www.nowcoder.com/practice/b6e7a9ca04d8418b805b3b4b7d25b4d4

#include <stdio.h>

struct peo
{
    char name[10];
    int a;
    int b;
    int c;
};

int main() 
{
    struct peo s[10000];
    int max=0;
    int maxx=0;
    int n=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%s %d %d %d",s[i].name,&(s[i].a),&(s[i].b),&(s[i].c));
        if(s[i].a+s[i].b+s[i].c>max)
        {
            max=s[i].a+s[i].b+s[i].c;
            maxx=i;
        }
    }
  printf("%s %d %d %d",s[maxx].name,s[maxx].a,s[maxx].b,s[maxx].c);
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务