본문 바로가기
공부/코딩테스트

백준: 16693번 Pizza Deal (Python3)

by 혼밥맨 2022. 8. 10.
반응형

백준: 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
반응형

댓글