반응형
백준: 16693번 Pizza Deal (Python3)
Pizza Deal 성공다국어
시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) | 512 MB (추가 메모리 없음) | 1737 | 812 | 710 | 46.741% |
문제
There’s a pizza store which serves pizza in two sizes: either a pizza slice, with area A1 and price P1, or a circular pizza, with radius R1 and price P2.
You want to maximize the amount of pizza you get per dollar. Should you pick the pizza slice or the whole pizza?
입력
The first line contains two space-separated integers A1 and P1.
Similarly, the second line contains two space-separated integers R1 and P2.
It is guaranteed that all values are positive integers at most 103. We furthermore guarantee that the two will not be worth the same amount of pizza per dollar.
출력
If the better deal is the whole pizza, print ‘Whole pizza’ on a single line.
If it is a slice of pizza, print ‘Slice of pizza’ on a single line.
예제 입력 1
8 4
7 9
예제 출력 1
Whole pizza
예제 입력 2
9 2
4 7
예제 출력 2
Whole pizza
예제 입력 3
841 108
8 606
예제 출력 3
Slice of pizza
답안
1
2
3
4
5
6
7
8
9
|
from math import pi
A1, P1 = map(int,input().split())
R1, P2 = map(int,input().split())
slice_area_per_dollar = A1/P1
whole_area_per_dollar = R1**2*pi/P2
print("Whole pizza" if whole_area_per_dollar>slice_area_per_dollar else "Slice of pizza")
|
cs |
반응형
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 16486번 운동장 한 바퀴 (Python3) (0) | 2022.08.11 |
---|---|
백준: 16600번 Contemporary Art (Python3) (0) | 2022.08.11 |
백준: 16727번 ICPC (Python3) (0) | 2022.08.10 |
백준: 14489번 치킨 두 마리 (Python3) (0) | 2022.08.10 |
백준: 17356번 욱 제 (Python3) (0) | 2022.08.10 |
댓글