結果
| 問題 |
No.192 合成数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-12 11:22:34 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 299 ms / 2,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 11,966 ms |
| コンパイル使用メモリ | 427,656 KB |
| 実行使用メモリ | 49,780 KB |
| 最終ジャッジ日時 | 2024-11-19 20:24:23 |
| 合計ジャッジ時間 | 21,995 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
^
ソースコード
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
}
}
}
}