結果

問題 No.648  お や す み 
ユーザー 💕💖💞
提出日時 2018-02-15 23:13:45
言語 Kotlin
(2.1.0)
結果
WA  
実行時間 -
コード長 222 bytes
コンパイル時間 10,518 ms
コンパイル使用メモリ 423,352 KB
実行使用メモリ 50,048 KB
最終ジャッジ日時 2024-11-20 13:45:19
合計ジャッジ時間 34,232 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 80 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun main(args:Array<String>) {
  val n = readLine()!!.toDouble()
  val a = (Math.sqrt(8*n+1) - 1)/2
  when { 
    Math.floor(a) == a -> { 
      println("YES")
      println(a.toInt())
    }
    else -> println("NO")
  }
}
0