結果

問題 No.192 合成数
ユーザー javyjavy
提出日時 2015-11-12 11:22:34
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 9,338 ms
コンパイル使用メモリ 428,940 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2024-04-30 06:38:15
合計ジャッジ時間 17,541 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
54,296 KB
testcase_01 AC 239 ms
54,216 KB
testcase_02 AC 240 ms
54,264 KB
testcase_03 AC 237 ms
54,224 KB
testcase_04 AC 241 ms
54,120 KB
testcase_05 AC 245 ms
54,268 KB
testcase_06 AC 241 ms
54,036 KB
testcase_07 AC 237 ms
54,224 KB
testcase_08 AC 240 ms
54,260 KB
testcase_09 AC 242 ms
54,248 KB
testcase_10 AC 253 ms
54,124 KB
testcase_11 AC 268 ms
54,288 KB
testcase_12 AC 245 ms
54,072 KB
testcase_13 AC 250 ms
54,268 KB
testcase_14 AC 245 ms
54,036 KB
testcase_15 AC 247 ms
54,280 KB
testcase_16 AC 250 ms
54,272 KB
testcase_17 AC 241 ms
54,120 KB
testcase_18 AC 238 ms
54,216 KB
testcase_19 AC 247 ms
54,112 KB
testcase_20 AC 242 ms
54,152 KB
testcase_21 AC 239 ms
54,208 KB
testcase_22 AC 240 ms
54,124 KB
testcase_23 AC 245 ms
54,228 KB
testcase_24 AC 238 ms
54,260 KB
testcase_25 AC 250 ms
54,188 KB
testcase_26 AC 242 ms
54,184 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