5585 거스름돈, 1439 뒤집기, 2012 등수 매기기
5585 거스름돈, 1439 뒤집기, 2012 등수 매기기 5585 거스름돈 # 첫번째 풀이 money_list = [500, 100, 50, 10, 5, 1] money = int(input()) money = 1000 - money count = 0 for i in money_list: if money < i: continue else: count += money // i money = money % i print(count) # 두번째 풀이(더 간단하게) money = 1000 - int(input()) count = 0 for i in [500, 100, 50, 10, 5, 1]: count += money // i money %= i print(count) 1439 뒤집기 s = input() ..
2020. 10. 12.
1012 유기농 배추, 1325 효율적인 해킹, 10282 해킹
1012 유기농 배추, 1325 효율적인 해킹, 10282 해킹 1012 유기농 배추 import sys sys.setrecursionlimit(100000) def dfs(v, w): visited[v][w] = True directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] for dx, dy in directions: nx, ny = v + dx, w + dy if nx = n or ny = m: continue if adj[nx][ny] and not visited[nx][ny]: dfs(nx, ny) for _ in range(int(input())): m, n, k = map(int, input().split()) visit..
2020. 10. 8.