https://atcoder.jp/contests/abc128/tasks/abc128_a
a,p = map(int,input().split())
print((a*3+p)//2)
The answer is a × 3 + p divided by 2.
https://atcoder.jp/contests/abc128/tasks/abc128_b
n = int(input())
x = [[input().split(),i+1]for i in range(n)]
x = sorted(x, key = lambda x:(x[0][0],-int(x[0][1])))
for i in range(n):
print(x[i][1])
The problem of sorting on multiple elements. x = sorted(x, key = lambda x:(x[0][0],-int(x[0][1]))) If multiple keys are specified in, sorting is performed in the order of x [0] [0], -int (x [0] [1]). Since the output is by number, create a list that includes the number when entering x.
https://atcoder.jp/contests/abc128/tasks/abc128_c
Recommended Posts