結果

問題 No.136 Yet Another GCD Problem
ユーザー バカらっくバカらっく
提出日時 2019-10-03 16:13:57
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 14,386 ms
コンパイル使用メモリ 443,324 KB
実行使用メモリ 60,476 KB
最終ジャッジ日時 2024-04-14 09:28:31
合計ジャッジ時間 26,754 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 329 ms
60,348 KB
testcase_01 AC 309 ms
56,836 KB
testcase_02 AC 323 ms
60,296 KB
testcase_03 AC 321 ms
60,368 KB
testcase_04 AC 327 ms
60,476 KB
testcase_05 WA -
testcase_06 AC 325 ms
60,296 KB
testcase_07 WA -
testcase_08 AC 326 ms
60,260 KB
testcase_09 AC 304 ms
56,944 KB
testcase_10 AC 325 ms
60,380 KB
testcase_11 AC 329 ms
60,228 KB
testcase_12 WA -
testcase_13 AC 326 ms
60,344 KB
testcase_14 AC 326 ms
60,328 KB
testcase_15 AC 332 ms
60,288 KB
testcase_16 AC 329 ms
60,432 KB
testcase_17 AC 323 ms
60,184 KB
testcase_18 WA -
testcase_19 AC 328 ms
60,372 KB
testcase_20 AC 325 ms
60,252 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 316 ms
56,872 KB
testcase_24 WA -
testcase_25 AC 316 ms
56,952 KB
testcase_26 AC 327 ms
60,376 KB
testcase_27 AC 323 ms
60,348 KB
testcase_28 AC 353 ms
60,324 KB
testcase_29 AC 327 ms
60,284 KB
testcase_30 WA -
testcase_31 AC 324 ms
60,312 KB
testcase_32 AC 331 ms
60,316 KB
testcase_33 AC 309 ms
57,148 KB
testcase_34 AC 327 ms
60,368 KB
testcase_35 AC 307 ms
56,876 KB
testcase_36 AC 310 ms
56,840 KB
testcase_37 AC 327 ms
60,308 KB
testcase_38 AC 312 ms
56,860 KB
testcase_39 AC 329 ms
60,460 KB
testcase_40 AC 311 ms
56,844 KB
testcase_41 AC 310 ms
56,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun main(args:Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    if(k >= n) {
        println(1)
        return
    }
    if(k == 1L) {
        println(n)
        return
    }

    val maxIndex = Math.sqrt(n.toDouble()).toLong()
    var ans = 1L
    for(i in (1..maxIndex)) {
        if(n % i != 0L) {
            continue
        }
        val num = (n/i).let { listOf(it, n / it) }.sortedDescending()
        for(j in num) {
            val tmp = n / j
            if(2 <= tmp) {
                ans = Math.max(ans, j)
            }
        }
    }
    println(ans)
}

0