結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー nobigomunobigomu
提出日時 2018-06-08 19:29:47
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 9,756 ms
コンパイル使用メモリ 431,732 KB
実行使用メモリ 54,316 KB
最終ジャッジ日時 2024-04-30 18:49:17
合計ジャッジ時間 13,682 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 246 ms
54,268 KB
testcase_01 AC 250 ms
54,204 KB
testcase_02 AC 244 ms
54,164 KB
testcase_03 AC 248 ms
54,084 KB
testcase_04 AC 252 ms
54,168 KB
testcase_05 AC 250 ms
54,120 KB
testcase_06 AC 241 ms
54,224 KB
testcase_07 AC 248 ms
54,168 KB
testcase_08 AC 246 ms
54,148 KB
testcase_09 AC 241 ms
54,316 KB
testcase_10 AC 256 ms
54,316 KB
testcase_11 AC 245 ms
54,272 KB
testcase_12 AC 247 ms
54,136 KB
testcase_13 AC 245 ms
54,164 KB
testcase_14 AC 248 ms
54,108 KB
testcase_15 AC 248 ms
54,232 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) = println(f(readLine()!!.toInt()))
         ^

ソースコード

diff #

fun f(m: Int): Int {
    val t = 2017%m
    tailrec fun iter(n: Int, r: Int): Int = if (n>1) iter(n-1,(r*t)%m) else (t+r)%m
    return iter(2*2017,t)
}
fun main(args: Array<String>) = println(f(readLine()!!.toInt()))
0