관리 메뉴

솜씨좋은장씨

[BaekJoon] 16693번 : Pizza Deal (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 16693번 : Pizza Deal (Python)

솜씨좋은장씨 2022. 10. 20. 12:14
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Pizza Deal 입니다.

 

16693번: Pizza Deal

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

www.acmicpc.net

👨🏻‍💻 코드 ( Solution )

import math


def pizza_deal(A1, P1, R1, P2):
    pizza01 = P1 / A1
    pizza02 = P2 / (pow(R1, 2) * math.pi)
    
    return "Whole pizza" if pizza01 > pizza02 else "Slice of pizza"

if __name__ == "__main__":
    A1, P1 = map(int, input().split())
    R1, P2 = map(int, input().split())
    
    print(pizza_deal(A1=A1, P1=P1, R1=R1, P2=P2))
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments