結果

問題 No.2379 Burnside's Theorem
ユーザー 👑 箱星箱星
提出日時 2022-09-29 20:58:10
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 1,261 bytes
コンパイル時間 16,891 ms
コンパイル使用メモリ 422,684 KB
実行使用メモリ 54,688 KB
最終ジャッジ日時 2023-10-14 10:43:36
合計ジャッジ時間 20,204 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 268 ms
52,564 KB
testcase_01 AC 267 ms
54,376 KB
testcase_02 AC 270 ms
52,400 KB
testcase_03 AC 271 ms
54,348 KB
testcase_04 AC 268 ms
52,352 KB
testcase_05 AC 267 ms
52,608 KB
testcase_06 AC 266 ms
54,404 KB
testcase_07 AC 266 ms
52,596 KB
testcase_08 AC 267 ms
54,688 KB
testcase_09 AC 268 ms
52,536 KB
testcase_10 AC 275 ms
52,604 KB
testcase_11 AC 267 ms
52,332 KB
testcase_12 AC 268 ms
52,524 KB
testcase_13 AC 279 ms
52,828 KB
testcase_14 AC 286 ms
54,504 KB
testcase_15 AC 283 ms
52,672 KB
testcase_16 AC 274 ms
54,396 KB
testcase_17 AC 271 ms
54,604 KB
testcase_18 AC 274 ms
52,844 KB
testcase_19 AC 267 ms
54,484 KB
testcase_20 AC 269 ms
52,420 KB
testcase_21 AC 268 ms
54,476 KB
testcase_22 AC 266 ms
54,460 KB
testcase_23 AC 271 ms
52,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextLong()
    // region prime factorization
    var number = n
    var divisor = 2L
    val pf = mutableMapOf<Long, Int>()
    while (divisor * divisor <= number) {
        var count = 0
        while (number % divisor == 0L) {
            number /= divisor
            count++
        }
        if (count > 0) {
            pf[divisor] = count
        }
        divisor++
    }
    if (number > 1) pf[number] = 1
    // endregion
    println(if (pf.size <= 2) "Yes" else "No")
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0