結果

問題 No.312 置換処理
ユーザー 826814741_6
提出日時 2019-01-09 23:55:25
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 12,260 ms
コンパイル使用メモリ 430,772 KB
実行使用メモリ 49,976 KB
最終ジャッジ日時 2024-11-15 12:26:06
合計ジャッジ時間 27,024 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:10:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

import kotlin.math.*

fun g(n: Long): Long = floor(sqrt(n.toDouble())).toLong()

fun f(m: Long, n: Long): Long {
    for (i in 3..m) if (n%i==0L) return i
    return if (n!=4L&&n%2==0L) n/2 else n
}

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    println(f(g(n),n))
}
0