結果

問題 No.2795 Perfect Number
ユーザー 箱星箱星
提出日時 2024-06-28 21:21:45
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 936 bytes
コンパイル時間 10,059 ms
コンパイル使用メモリ 438,768 KB
実行使用メモリ 62,228 KB
最終ジャッジ日時 2024-06-28 21:22:19
合計ジャッジ時間 21,692 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val a = arrayOf(6, 28, 496, 8128, 33550336, 8589869056, 137438691328, 2305843008139952128)
    val n = nextLong()
    println(if (a.contains(n)) "Yes" else "No")
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0