2021全国计算机挑战赛

输入N个人的语(chinese)数(math)外(english)考试成绩,请输出总分最低的学生和单科最低的学生,相同的成绩也要输出(按照原来的顺序)

输入: 一个整数n表示n个人的考试成绩(1<n<=1000),随后有n行,每行依次是这个学生的姓名,语文成绩,数学成绩,外语成绩(都是整数)
输出: 首先输出语文最低的人(可以并列),然后是数学最低的, 外语最低的,最后输出总分最低的人(可以并列)具体格式参考输出样例

输入样例
5
tom    100  99  98
alice  100 100 100
peter  89   89 100
jerry  60  100 100
cat    60   50  50


输出样例
lower chinese:
jerry(60)
cat(60)

lower math:
cat(50)

lower english:
cat(50)

lower score:
cat(160)

# include<iostream>
# include<stdio.h>
using namespace std;
struct stu
{
	char name[10];
	int a,b,c;	
};

int main()
{
	stu st[100];
	int n,i,x,y,z,e;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>st[i].name>>st[i].a>>st[i].b>>st[i].c;
	}
	for(i=0;i<n;i++)
	{
		 x=st[i].a;
		if(st[i].a<x)
		{
			x=st[i].a;
		}
	}
	cout<<"lower chinese:"<<endl;
	for(i=0;i<n;i++)
	{
		if(x==st[i].a)
		{
			printf("%s(%d)\n",st[i].name,x);
		}
	}
	printf("\n");
	for(i=0;i<n;i++)
	{
		y=st[i].b;
		if(st[i].b<y)
		{
			y=st[i].b;
		}
	}
	cout<<"lower math:"<<endl;
	for(i=0;i<n;i++)
	{
		if(y==st[i].b)
		{
			printf("%s(%d)\n",st[i].name,y);
		}
	}
	for(i=0;i<n;i++)
	{
		z=st[i].c;
		if(st[i].c<z)
		{
			y=st[i].c;
		}
	}
	cout<<endl;
	cout<<"lower english:"<<endl;
	for(i=0;i<n;i++)
	{
		if(y==st[i].c)
		{
			printf("%s(%d)\n",st[i].name,z);
		}
	}
	cout<<endl;
	for(i=0;i<n;i++)
	{
		e=st[i].a+st[i].b+st[i].c;
		if(st[i].a+st[i].b+st[i].c<e)
		{
			e=st[i].a+st[i].b+st[i].c;
		}
	}
	cout<<"lower score:"<<endl;
	for(i=0;i<n;i++)
	{
		if(e==st[i].a+st[i].b+st[i].c)
		{
			printf("%s(%d)",st[i].name,e);
		}
	}
	return 0;
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小超学长162

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值