[백준] Pizza Deal (16693)(kotlin)

원본 문제

문제 설명

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.

테스트 케이스

입력 출력
8 4
7 9
Whole Pizza
9 2
4 7
Whole Pizza
841 108
8 606
Slice of pizza

문제 풀이1

import java.util.Scanner
import kotlin.math.pow

fun main(args: Array<String>) = with(Scanner(System.`in`)){
    val a1 = nextDouble()
    val p1 = nextDouble()
    val r1 = nextDouble()
    val p2 = nextDouble()
    val a2 = r1.pow(2) * kotlin.math.PI

    if (a1 / p1 < a2 / p2) println("Whole pizza")
    else println("Slice of pizza")
}