結果

問題 No.1177 余りは?
ユーザー yudedakoyudedako
提出日時 2020-08-22 09:25:01
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 313 ms / 1,000 ms
コード長 261 bytes
コンパイル時間 13,300 ms
コンパイル使用メモリ 437,908 KB
実行使用メモリ 57,272 KB
最終ジャッジ日時 2024-04-23 06:59:47
合計ジャッジ時間 20,924 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 283 ms
57,040 KB
testcase_01 AC 286 ms
57,232 KB
testcase_02 AC 287 ms
57,228 KB
testcase_03 AC 288 ms
57,104 KB
testcase_04 AC 281 ms
57,084 KB
testcase_05 AC 282 ms
57,128 KB
testcase_06 AC 279 ms
57,072 KB
testcase_07 AC 283 ms
57,144 KB
testcase_08 AC 293 ms
57,072 KB
testcase_09 AC 285 ms
57,096 KB
testcase_10 AC 272 ms
57,040 KB
testcase_11 AC 277 ms
57,016 KB
testcase_12 AC 276 ms
57,184 KB
testcase_13 AC 283 ms
57,088 KB
testcase_14 AC 278 ms
57,084 KB
testcase_15 AC 277 ms
57,096 KB
testcase_16 AC 290 ms
57,044 KB
testcase_17 AC 287 ms
57,032 KB
testcase_18 AC 313 ms
57,212 KB
testcase_19 AC 287 ms
57,028 KB
testcase_20 AC 285 ms
57,144 KB
testcase_21 AC 284 ms
57,036 KB
testcase_22 AC 286 ms
57,096 KB
testcase_23 AC 283 ms
57,116 KB
testcase_24 AC 281 ms
57,084 KB
testcase_25 AC 289 ms
57,068 KB
testcase_26 AC 290 ms
57,272 KB
testcase_27 AC 287 ms
57,112 KB
testcase_28 AC 284 ms
57,080 KB
testcase_29 AC 285 ms
57,216 KB
testcase_30 AC 285 ms
57,040 KB
testcase_31 AC 282 ms
56,932 KB
testcase_32 AC 273 ms
57,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


const val MOD = 1000000007L

fun main() {
    val (p, k) = readLine()!!.trim().split(' ').map(String::toInt)
    var q = 0L
    var r = 1
    repeat(p) {
        q = (q * 10 + r / p) % MOD
        r = (r % p) * 10
    }
    println(if (k == 0) q + 1 else q)
}
0