結果

問題 No.1396 Giri
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2021-02-17 16:15:57
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 508 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 16,107 ms
コンパイル使用メモリ 415,352 KB
実行使用メモリ 95,992 KB
最終ジャッジ日時 2023-10-12 03:21:56
合計ジャッジ時間 28,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 284 ms
52,724 KB
testcase_01 AC 281 ms
52,680 KB
testcase_02 AC 508 ms
94,096 KB
testcase_03 AC 286 ms
52,692 KB
testcase_04 AC 286 ms
53,040 KB
testcase_05 AC 505 ms
94,636 KB
testcase_06 AC 281 ms
52,648 KB
testcase_07 AC 284 ms
52,936 KB
testcase_08 AC 284 ms
52,816 KB
testcase_09 AC 283 ms
52,684 KB
testcase_10 AC 281 ms
52,748 KB
testcase_11 AC 280 ms
52,628 KB
testcase_12 AC 292 ms
52,856 KB
testcase_13 AC 289 ms
52,472 KB
testcase_14 AC 285 ms
52,824 KB
testcase_15 AC 285 ms
52,800 KB
testcase_16 AC 285 ms
52,800 KB
testcase_17 AC 293 ms
52,660 KB
testcase_18 AC 314 ms
55,624 KB
testcase_19 AC 393 ms
67,892 KB
testcase_20 AC 446 ms
75,236 KB
testcase_21 AC 500 ms
93,520 KB
testcase_22 AC 500 ms
94,224 KB
testcase_23 AC 500 ms
94,152 KB
testcase_24 AC 498 ms
94,124 KB
testcase_25 AC 508 ms
95,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//
// Created by zeronosu77108 on 2021/02/17.
//
import kotlin.collections.*
import kotlin.math.*

@kotlin.ExperimentalStdlibApi
fun main() {
    val n = readLine()!!.toInt()

    val primes = mutableListOf<Long>()
    val sieve = Array<Long>(n+1) { it.toLong() }
    for (i in 2 .. n.toLong()) {
        if (sieve[i.toInt()] == i) primes.add(i)
        for (p in primes) {
            if (i*p > n) break
            sieve[(i*p).toInt()] = p
        }
    }

    var ans = 1L
    for (p in primes.dropLast(1)) {
        var q = p;
        while (q*p <= n) q*=p
        ans *= q % 998244353
        ans %= 998244353
    }
    println(ans)
}
0