package Yukicoder /** * Created by hichikawa on 2015/11/12. */ fun main(args: Array) { fun readLineLongArray(): List { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toLong() } return ret } fun readLineLong(): Long { val str = readLine() as String return str.toLong() } fun readLineInt(): Int { val str = readLine() as String return str.toInt() } fun readLineIntArray() : List { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toInt() } return ret } fun readLineDoubleArray(): List { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toDouble() } return ret } val sumMoney = readLineLong() val num = readLineLong() val modi = (sumMoney % (num * 1000)) / 1000 val minModi = Math.min(modi , num-modi) as Long var numC : Long = 1 for (i : Long in num downTo (num-minModi+1)) { numC *= i } var modiC : Long = 1 for (i : Long in 2..minModi) { modiC *= i } // println(minModi) // println(numC) // println(modiC) // println(num) // println(modi) println(numC / modiC) }