[백준] Bicycle (20233)(kotlin)

문제 설명

백준 20233번 문제 링크

입력 및 출력

» 입력

The first four lines of the input contain integers a , x , b , and y ( 0≤a,x,b,y≤100 ), each on a separate line. The last line contains a single integer T ( 1≤T≤1440 ) --- the total time spent on a bicycle during each day.

» 출력

The only line of the output should contain two integers --- the amount of money you would spend on the first option and the second option, respectively.

예제 입출력

입력 출력
10
1
20
5
50
430 545
10
10
10
10
42
2530 10
10
10
10
10
27
10 10

문제 풀이1

import java.util.Scanner

fun main(args: Array<String>) = with(Scanner(System.`in`)){
    val a = nextInt()
    val x = nextInt()
    val b = nextInt()
    val y = nextInt()
    val t = nextInt()

    val option1 = a + if (t > 30) (t - 30) * x * 21 else 0
    val option2 = b + if (t > 45) (t - 45) * y * 21 else 0
    println("$option1 $option2")
}