結果

問題 No.1224 I hate Sqrt Inequality
ユーザー rutilicusrutilicus
提出日時 2020-09-12 10:58:02
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 991 bytes
コンパイル時間 13,298 ms
コンパイル使用メモリ 428,280 KB
実行使用メモリ 57,840 KB
最終ジャッジ日時 2023-08-30 03:39:40
合計ジャッジ時間 18,855 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 296 ms
56,340 KB
testcase_01 AC 298 ms
52,864 KB
testcase_02 AC 294 ms
53,144 KB
testcase_03 AC 290 ms
52,980 KB
testcase_04 AC 296 ms
53,056 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:43:13: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln("No")
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val (a, b) = readInputLine().split(" ").map { it.toLong() }

    val divisorsA = mutableMapOf<Long, Long>()
    val divisorsB = mutableMapOf<Long, Long>()

    var aTmp = a

    for (i in LongRange(2L, a)) {
        if (aTmp == 1L) {
            break
        }
        while (aTmp % i == 0L) {
            divisorsA[i] = (divisorsA[i] ?: 0L) + 1L
            aTmp /= i
        }
    }

    var bTmp = b

    for (i in LongRange(2L, b)) {
        if (bTmp == 1L) {
            break
        }
        while (bTmp % i == 0L) {
            divisorsB[i] = (divisorsB[i] ?: 0L) + 1L
            bTmp /= i
        }
    }

    for ((p, cnt) in divisorsB) {
        if (p == 2L || p == 5L) {
            continue
        }
        if (cnt > (divisorsA[p] ?: 0L)) {
            println("Yes")
            return
        }
    }

    builder.appendln("No")

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0