사칙연산 144

백준(Python) 22193번 Multiply 풀이

Python으로 구현한 22193번 Multiply 문제 풀이입니다. https://www.acmicpc.net/problem/22193 22193번: Multiply Write a program that computes a product of two non-negative integers A and B. The integers are represented in decimal notation and have N and M digits, respectively. www.acmicpc.net n, m = map(int, input().split()) a = int(input()) b = int(input()) print(a * b) 1. 입력받은 두 수(a, b)의 곱을 구하여 출력한다.

백준(Python) 6749번 Next in line 풀이

Python으로 구현한 6749번 수강변경 문제 풀이입니다. https://www.acmicpc.net/problem/6749 6749번: Next in line You know a family with three children. Their ages form an arithmetic sequence: the difference in ages between the middle child and youngest child is the same as the difference in ages between the oldest child and the middle child. For example, their ages c www.acmicpc.net y = int(input()) m = int(input()) ..

백준(Python) 15720번 카우버거 풀이

Python으로 구현한 15720번 카우버거 문제 풀이입니다. https://www.acmicpc.net/problem/15720 15720번: 카우버거 첫째 줄에는 주문한 버거의 개수 B, 사이드 메뉴의 개수 C, 음료의 개수 D가 공백을 사이에 두고 순서대로 주어진다. (1 ≤ B, C, D ≤ 1,000) 둘째 줄에는 각 버거의 가격이 공백을 사이에 두고 주어진 www.acmicpc.net b, c, d = map(int, input().split()) burger = list(map(int, input().split())) side = list(map(int, input().split())) drink = list(map(int, input().split())) burger.sort(reverse..

백준(Python) 1434번 책 정리 풀이

Python으로 구현한 1434번 책 정리 문제 풀이입니다. https://www.acmicpc.net/problem/1434 1434번: 책 정리 첫째 줄에 박스의 개수 N, 책의 개수 M이 주어진다. 둘째 줄에는 박스의 용량 A1, A2, ..., AN이 주어지고, 셋째 줄에는 B1, B2, ..., BM이 주어진다. www.acmicpc.net n, m = map(int, input().split()) box = list(map(int, input().split())) book = list(map(int, input().split())) for i in range(len(book)) : for j in range(len(box)) : if book[i] > box[j] : continue box[j..

백준(Python) 22864번 피로도 풀이

Python으로 구현한 22864번 피로도 문제 풀이입니다. https://www.acmicpc.net/problem/22864 22864번: 피로도 첫 번째 줄에 $A$, $B$, $C$, $M$이 공백으로 구분되어 주어진다. (하루는 24시간이다.) 맨 처음 피로도는 0이다. www.acmicpc.net a, b, c, m = map(int, input().split()) day = 0 result = 0 count = 0 if a > m : print(0) else : while day != 24 : day += 1 if count + a = 0 : count -= c else : count = 0 print(result) 1. 초기 피로도는 0이며, 피로도(a)가 번아웃 경계(m)보다 클 경우 일..

백준(Python) 6679번 싱기한 네자리 숫자 풀이

Python으로 구현한 6679번 싱기한 네자리 숫자 문제 풀이입니다. https://www.acmicpc.net/problem/6679 6679번: 싱기한 네자리 숫자 싱기한 네자리 숫자란, [1000,9999]인 10진수 숫자중에서, 다음의 조건을 만족하는 숫자를 말한다. 숫자를 10진수, 12진수, 16진수로 나타낸 다음, 각각의 숫자에 대해, 각 숫자의 자리수를 더했을 www.acmicpc.net for i in range(2992, 10000) : data = i sixteen = 0 while data != 0 : sixteen += data % 16 data //= 16 data = i twelve = 0 while data != 0 : twelve += data % 12 data //= 1..

백준(Python) 13985번 Equality 풀이

Python으로 구현한 13985번 Equality 문제 풀이입니다. https://www.acmicpc.net/problem/13985 13985번: Equality Print, on a single line, YES if the sum is correct; otherwise, print NO. www.acmicpc.net data, result = map(str, input().split(' = ')) if int(eval(data)) == int(result) : print('YES') else : print('NO') 1. 입력받은 문자열을 '='로 구분하여 각 data와 result에 할당한다. 2. 조건문에서 eval( )을 사용하여 data의 식의 결과가 result와 같을 경우 'YES'를..

백준(Python) 12756번 고급 여관 풀이

Python으로 구현한 12756번 고급 여관 문제 풀이입니다. https://www.acmicpc.net/problem/12756 12756번: 고급 여관 플레이어 A의 카드가 남아있다면 "PLAYER A"를, 플레이어 B의 카드가 남아있다면 "PLAYER B"를 출력한다. 모두 죽은 상태라면 "DRAW"를 따옴표 없이 출력한다. www.acmicpc.net a_attack, a_hp = map(int, input().split()) b_attack, b_hp = map(int, input().split()) while True : a_hp -= b_attack b_hp -= a_attack if a_hp

백준(Python) 11134번 쿠키애호가 풀이

Python으로 구현한 11134번 쿠키애호가 문제 풀이입니다. https://www.acmicpc.net/problem/11134 11134번: 쿠키애호가 철수는 쿠키를 세상에서 제일 좋아한다. 쿠키가 있는 곳이라면 철수도 반드시 있다고 할 정도이다. 철수는 날마다 자신이 가지고 있는 쿠키 중 C개를 먹는다. C개 미만의 쿠키가 남아 있다면 전 www.acmicpc.net t = int(input()) for _ in range(t) : n, c = map(int, input().split()) if n % c == 0 : print(n // c) else : print(n // c + 1) 1. 조건문을 통해 철수가 가진 쿠키의 개수(n)에서 날마다 먹는 쿠키의 개수(c)를 나눈 나머지 값이 0이라면..