当前位置:网站首页>C243: examination ranking
C243: examination ranking
2022-07-27 20:01:00 【Qiangan】
Problem description
There is 5 Problem sum 1 Additional questions , The highest score per question 20 branch , The total score is calculated as the sum of the scores of all topics . Give the data of a group of candidates , Rank them from high to low according to the total score , If the total score is the same, the one with higher score according to the additional questions will be preferred .
Enter description
The first line is an integer N, Indicates the number of candidates (N Less than 100), Back N Behavioral candidate data , Each line contains the candidate's name ( Length not exceeding 20 Characters ) as well as 6 An integer separated by spaces , It represents the scores of questions 1 to 5 and additional questions respectively ( Last item ).
The output shows that
Output sorting results , The name of each candidate 、 Total score 、 Additional questions score , Separate... By spaces .
sample input
3
Jony 18 20 20 20 20 20
Kavin 20 20 20 20 20 18
Kaku 15 15 15 15 15 15
sample output
Jony 118 20
Kavin 118 18
Kaku 90 15
#include<stdio.h>
int main()
{
int n,i,j;
struct stu
{
char m[20];
int f[6];
int z=0;
}a[100],t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",a[i].m);
for(j=0;j<6;j++)
{
scanf("%d",&a[i].f[j]);
a[i].z+=a[i].f[j];
}
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(a[j].z<a[j+1].z)
{
t=a[j];a[j]=a[j+1];a[j+1]=t;
}
else if(a[j].z==a[j+1].z)
{
if(a[j].f[5]<a[j+1].f[5])
{
t=a[j];a[j]=a[j+1];a[j+1]=t;
}
}
}
}
for(i=0;i<n;i++)
{
printf("%s %d %d",a[i].m,a[i].z,a[i].f[5]);
if(i!=n-1) printf("\n");
}
return 0;
}
边栏推荐
- Datepicker and TimePicker
- C # network application programming, experiment 1: WPF exercise
- Session攻击
- 【OpenBMC 系列】4.启动流程 使用qume模拟ast2600-evb
- SQLite SQL writing method of creating table joint primary key
- Oracle +JDBC
- China business CDP white paper | love Analysis Report
- ContentProvider of four components
- Systemservice (system service)
- ACL11.12
猜你喜欢

Chapter 2 Introduction

pytorch 常见报错

22年PMP考试【全真敏捷试题】

化工巨头巴斯夫&Pasqal:利用量子神经网络优化天气预报

Radiogroup (radio box)

No experts! Growth secrets for junior and intermediate programmers and "quasi programmers" who are still practicing in Universities

软件配置 | tigerVNC的下载、安装及配置

Common errors reported by pytorch

Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night

真实案例,大学生接单被骗,希望大家不要被骗了【惨痛教训】
随机推荐
VLAN test 2021.1.14
AcWing 692. G巴士计数 差分+前缀和
How powerful can top "hackers" be? Internet access without signal, expert: high-end operation!
pytorch tensor的基本函数
Container summary
探索新一代活动获客方式,虚拟化活动棋胜一招 | 厂商征集
Chapter 2 Introduction
ContextMenu (context menu)
顶级“黑客”能厉害到什么地步?无信号也能上网,专家:高端操作!
能上QQ但网页打不开
Datepicker and TimePicker
邬贺铨:因地制宜 数字化技术赋能“双碳”实践
PC博物馆(3) MITS Altair 8800
[RCTF2015]EasySQL-1|SQL注入
China business CDP white paper | love Analysis Report
C191:密码编译
transformers-bert
ContentProvider of four components
信道容量、信道带宽基本概念的理解
【IoT】卫朋:6000+ 字解读 | 2022年产品人必备的7个产品管理工具(1.0版)