Algorithm89 [백준] 11047번 동전 0 오래 안걸린 문젠데 시간초과 때매 조금 고생했다 그래도 쉬운 문제.. for문제 reversed 안쓴 이유는 속도가 조금 더 느리길래.. 그냥 밖으로 뺐다 N, K = map(int, input().split()) counter = 0 A = [] for _ in range(N): temp = int(input()) if temp 2020. 10. 7. [백준] 14720번 우유 축제 쉬운 문제 이지만.. 조금 헤멤... 댕청.. N = int(input()) S = list(map(int, input().split())) counter = 0 current = 0 for i in range(len(S)): if S[i] == current: counter += 1 current += 1 if current == 3: current = 0 print(counter) 2020. 10. 6. [백준] 10162번 전자레인지 아주 쉬운 문제.. 더 쉽게 풀 수 있을꺼 같은데.. def greedy(N): counter = [0, 0, 0] while N > 0: if N % 300 == 0: N = N - 300 counter[0] += 1 elif N % 60 == 0: N = N - 60 counter[1] += 1 elif N % 10 == 0: N = N - 10 counter[2] += 1 else: return -1 return counter ans = greedy(int(input())) if ans == -1: print(ans) else: for i in range(len(ans)): print(ans[i], end=" ") 2020. 10. 6. [백준] 5585번 거스름돈 아주 쉬운 문제 def greedy(N): counter = 0 while N > 0: if N % 500 == 0: N = N - 500 counter += 1 elif N % 100 == 0: N = N - 100 counter += 1 elif N % 50 == 0: N = N - 50 counter += 1 elif N % 10 == 0: N = N - 10 counter += 1 elif N % 5 == 0: N = N - 5 counter += 1 else: N = N - 1 counter += 1 return counter print(greedy(1000 - int(input()))) 2020. 10. 6. 이전 1 ··· 12 13 14 15 16 17 18 ··· 23 다음