結果

問題 No.192 合成数
ユーザー javyjavy
提出日時 2015-11-11 17:19:09
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 9,468 ms
コンパイル使用メモリ 429,804 KB
実行使用メモリ 54,368 KB
最終ジャッジ日時 2024-04-30 06:26:17
合計ジャッジ時間 17,667 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
54,228 KB
testcase_01 AC 245 ms
54,140 KB
testcase_02 AC 241 ms
54,116 KB
testcase_03 AC 239 ms
54,120 KB
testcase_04 AC 242 ms
54,144 KB
testcase_05 AC 246 ms
54,308 KB
testcase_06 AC 240 ms
54,228 KB
testcase_07 AC 240 ms
54,124 KB
testcase_08 AC 243 ms
54,036 KB
testcase_09 AC 241 ms
54,248 KB
testcase_10 AC 238 ms
54,236 KB
testcase_11 AC 246 ms
54,028 KB
testcase_12 AC 250 ms
54,160 KB
testcase_13 AC 245 ms
54,216 KB
testcase_14 AC 245 ms
54,048 KB
testcase_15 AC 255 ms
54,132 KB
testcase_16 AC 247 ms
54,224 KB
testcase_17 AC 244 ms
54,152 KB
testcase_18 AC 241 ms
54,356 KB
testcase_19 AC 244 ms
54,312 KB
testcase_20 AC 241 ms
54,300 KB
testcase_21 AC 243 ms
54,136 KB
testcase_22 AC 245 ms
54,368 KB
testcase_23 AC 240 ms
54,240 KB
testcase_24 AC 240 ms
54,136 KB
testcase_25 AC 239 ms
54,128 KB
testcase_26 AC 244 ms
54,228 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package Yukicoder

/**
 * Created by hichikawa on 2015/11/11.
 */
fun main(args: Array<String>) {
    fun readLineLong() : Long {
        val str = readLine() as String
        return str.toLong()
    }

    val  num = readLineLong()
    if (num != 2.toLong() && num % 2.toLong() == 0.toLong()) {
        println(num)
        return
    }

    val min = Math.max(4, num - 100)
    loop@
    for (i in min..(num+100)) {
        if (i.toInt() % 2 == 0) {
            println(i)
            break
        }
        for (j in 3..(i-1) step 2) {
            if (i.toInt() % j.toInt() == 0) {
                println(i)
                break@loop
            }
        }
    }
}
0