목록algorithm (61)
현제의 현재이야기

n, m = tuple(map(int, input().split())) arr = list(map(int, input().split())) arr.sort(key=lambda x: (x % 10, x)) result = 0 pointer = 0 while m != 0 and pointer < n: if arr[pointer] == 10: result += 1 pointer += 1 elif arr[pointer] % 10 == 0: if m

n = int(input()) num_second = [0 for _ in range(n)] result = 0 first = [ input() for _ in range(n) ] second = [ input() for _ in range(n) ] for i in range(n): for j in range(n): if second[i] == first[j]: num_second[i] = j + 1 for i in range(n): for j in range(i + 1, n): if num_second[i] > num_second[j]: result += 1 break print(result) | 알고리즘 만약 입력이 5이면 5개씩 두 개의 리스트에 입력을 받는다 만약 second의 i번째 요소와 fi..

from collections import deque n = int(input()) teq = deque(map(int, input().split())) card = [i for i in range(1, n + 1)] card = deque(card) result = deque() while len(teq) != 0: teq_num = teq.pop() target = card.popleft() if teq_num == 1: result.appendleft(target) elif teq_num == 2: result.insert(1, target) else: result.append(target) for i in result: print(i, end=' ') | 알고리즘 1. 기술 리스트를 받고 기술 리..

a = list(input()) pointer = 0 word_cnt = 0 word_cnt_resister = 0 box = ['w','o','l','f'] box_pointer = 0 while pointer = 2 and word_cnt != word_cnt_resister: print('0') quit() else: word_cnt_resister = ..

from collections import deque a = int(input()) current = deque(map(int, input().split())) cnt = 1 solo_count = 0 # 한줄로 서있는 스택의 개수 while cnt = 1 and current[-1] == cnt: current.pop() solo_count -= 1 cnt += 1 else: if solo_count == len(current): if current[-1] != cnt: print('Sad') break current.ro..

import sys input = sys.stdin.readline def bomb(map, R, C): for i in range(R): for j in range(C): if map[i][j] == '.': map[i][j] = 'O' elif map[i][j] == 'O': map[i][j] = '1' if j > 0: map[i][j - 1] = '1' if j 0: map[i - 1][j] = '1' if i < R - 1 and map[i + 1][j] != 'O': map[i + 1][j] = '1' for i in range(R): for j in range(C): if map[i]..