백준2319 [백준/파이썬] 11294번 Numbers -Codeimport stringdef solution(n, f): res = "" temp = string.digits + string.ascii_uppercase while n > 0: n, mod = n // f, n % f res += temp[mod] return res[::-1]while True: name = input() if name == "#": break formation = int(input()) num = int(input()) print(f"{name}, {num}, {solution(num, formation)}") 2024. 8. 23. [백준/파이썬] 10501번 Ragged Right -Codearr = []res = 0while True: try: arr.append(len(input())) except: breakmax_len = max(arr)for el in arr[:-1]: res += (max_len - el) ** 2print(res) 2024. 8. 22. [백준/파이썬] 21614번 Secret Instructions -Coderes = "left"while True: n = input() if n == "99999": break sum_num = int(n[0]) + int(n[1]) if sum_num == 0 : pass elif sum_num % 2 == 1: res = "left" else: res = "right" if res == "left" else "right" print(f"{res} {n[2:]}") 2024. 8. 21. [백준/파이썬] 10902번 Penalty calculation -Codemax_s, f, tf, sf = 0, 0, 0, 0for i in range(1, int(input()) + 1): t, s = map(int, input().split()) if s > max_s: max_s = s f = i tf = t sf = sif sf == 0: print(0)else: print(tf + (f - 1) * 20) 2024. 8. 20. [백준/파이썬] 24408번 Mult! - Codefirst_num = -1for _ in range(int(input())): n = int(input()) if first_num == -1: first_num = n continue if n % first_num == 0: print(n) first_num = -1 2024. 8. 19. [백준/파이썬] 17838번 커맨드 -Codedef solution(line): if ( len(line) == 7 and line[0] == line[1] == line[4] and line[2] == line[3] == line[5] == line[6] and line[0] != line[6] ): return 1 return 0for _ in range(int(input())): s = input() print(solution(s)) 2024. 8. 18. 이전 1 ··· 21 22 23 24 25 26 27 ··· 387 다음