当前位置:网站首页>Openjudge: patient queuing
Openjudge: patient queuing
2022-07-28 05:36:00 【Programmer system】
describe
Patients register for treatment , Write a program , According to the following principles, the registered patients should be arranged in the order of seeing a doctor :
1. aged ( Age >= 60 year ) Priority over non elderly people .
2. The elderly see a doctor in the order of age , Those of the same age are listed in the order of registration .
3. Non elderly people see a doctor in the order of registration .
Input
The first 1 That's ok , Enter a value less than 100 The positive integer , Represents the number of patients ;
Then according to the order of patients registration , Enter one patient per line , Include : A length less than 10 The string of represents the patient's ID( Every patient's ID They are different and contain only numbers and letters ), An integer represents the patient's age , Separate them with a single space .
Output
Output the patient's information according to the arranged order of seeing a doctor ID, Each row of a .
The sample input
5 021075 40 004003 15 010158 67 021033 75 102012 30
Sample output
021033 010158 021075 004003 102012
n = int(input())
a = []
for i in range(n):
s = input().split()
lst = [str(s[0]),int(s[1]),i] # Add upper registration order
a.append(lst)
def f(x):
if x[1]>=60:
return(-x[1],x[2]) # From old to young
else:
return(0,x[2])
a.sort(key=f) #key For custom comparison functions , By function f Method comparison
for i in range(n):
print(a[i][0])边栏推荐
- Digital twin solutions inject new momentum into the construction of chemical parks
- Lamda gets the current number of cycles, atomicinteger
- (dark horse) MySQL beginner advanced notes (blogger lazy dog)
- 低照度图像数据集
- List < long >, list < integer > convert each other
- BigDecimal 进行四舍五入 四舍六入和保留两位小数
- ES6 new variable modifiers let and const, new basic data type symbol
- mysql 为查询结果增加序号
- (黑马)MYSQL初级-高级笔记(博主懒狗)
- 多线程进阶:synchronized底层原理,锁优化、锁升级的过程
猜你喜欢
随机推荐
LocalDateTime去掉T,JSONField失效
框架一步一步方便使用的流程
ssm项目快速搭建项目配置文件
regular expression
测试开发---自动化测试中的UI测试
深度学习热力图可视化的方式
Distillation model diagram
Digital twin solutions inject new momentum into the construction of chemical parks
openjudge:病人排队
数据库面试
How to compare long and integer and why to report errors
What are the methods of array objects in Es5 and what are the new methods in ES6
How about ink cloud?
BigDecimal rounds and retains two decimal places
C language characters and strings
Multi module packaging: package: XXX does not exist
科研论文写作方法:在方法部分添加分析和讨论说明自己的贡献和不同
Response<T>类
解决Oracle使用in语句不能超过1000问题
About localdatetime in swagger









