[백준] Vera and Outfits (15439)(kotlin)

원본 문제

문제 설명

Vera owns N tops and N pants. The i-th top and i-th pants have colour i, for 1 ≤ i ≤ N, where all N colours are different from each other.

An outfit consists of one top and one pants. Vera likes outfits where the top and pants are not the same colour.

How many different outfits does she like?

입력

The input will be in the format:

N

Constraints:

  • 1 ≤ N ≤ 2017
  • N is integer

출력

Output one line with the number of different outfits Vera likes.

테스트 케이스

입력 출력
1 0
2 2
5 20

문제 풀이1

fun main(args: Array<String>) = println(
    readLine()!!
        .toInt()
        .let { it * it - it }
)