結果

問題 No.648  お や す み 
コンテスト
ユーザー Pump0129
提出日時 2018-03-30 08:21:54
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
WA  
実行時間 -
コード長 250 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,509 ms
コンパイル使用メモリ 431,236 KB
実行使用メモリ 51,228 KB
最終ジャッジ日時 2026-05-14 17:57:41
合計ジャッジ時間 24,159 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 69 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package net.ipipip0129.kotlin.yukicoder

import kotlin.math.sqrt

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    val m = sqrt((n*2).toDouble()).toInt()
    println(if ((m*(m+1)/2).toLong() == n) "YES\n" + m else "NO")
}
0