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 num = readLineInt() if (num == 1) { println(1) } else if (num == 2) { println(2) } else { var arr = Array(num, {0}) arr[0] = 1 arr[1] = 1 for (i in 2..(num-1)) { arr[i] = arr[i-1] + arr[i-2] } println(arr[num-1] + arr[num-2]) } }