목록Python (215)
가오리의 코딩일기
student = [] for _ in range(int(input())): name, day, month, year = input().split() student.append([name, int(day), int(month), int(year)]) student.sort(key=lambda a: (a[3], a[2], a[1])) print(student[-1][0]) print(student[0][0])
import math a, b = map(int, input().split()) print(math.gcd(a, b)) # Greatest Common Divisor, 최대공약수 print(math.lcm(a, b)) # Least Common Multiple, 최소공배수
def solution(food_times, k): low, high = 0, 100000000 n, cutting, idx = len(food_times), 0, 0 while low 0: idx += 1 return -1
POINT - 서로 무게가 다른 볼링공을 고르는 경우의 수→ 경우의 수를 직접 구하는게 아니라 세기만 하면 된다 N, M = map(int, input().split()) k = list(map(int, input().split())) count = 0 for n in range(1, N): for m in range(1, N): if k[n] != k[m]: count += 1 print(count) n, m = map(int, input().split()) data = list(map(int, input().split())) array = [0] * 11 for x in data: array[x] += 1 result = 0 for i in range(1, m+1): n -= array[i] resu..
import sys n = int(sys.stdin.readline()) data = [list(sys.stdin.readline().split()) for _ in range(n)] data.sort(key=lambda a: (-int(a[1]), int(a[2]), -int(a[3]), a[0])) for i in data: sys.stdout.write(str(i[0])+'\n')
n = int(input()) data = [] for i in range(n): age, name = map(str, input().split()) age = int(age) data.append((age, name)) data.sort(key=lambda x: x[0]) # (age, name)에서 age만 비교 for i in data: print(i[0], i[1])
import sys n = int(sys.stdin.readline()) data = [] for i in range(n): [a, b] = map(int, sys.stdin.readline().split()) data.append([b, a]) sorted_data = sorted(data) for b, a in sorted_data: print(a, b)
import sys n = int(sys.stdin.readline()) data = [] for i in range(n): [a, b] = map(int, sys.stdin.readline().split()) data.append([a, b]) sorted_data = sorted(data) for i in range(n): print(sorted_data[i][0], sorted_data[i][1])
import sys n = int(input()) data = [] for i in range(n): data.append(int(sys.stdin.readline())) for i in sorted(data): sys.stdout.write(str(i)+'\n')