結果

問題 No.648  お や す み 
コンテスト
ユーザー norioc
提出日時 2024-11-08 10:08:49
言語 Elixir
(1.20.3)
コンパイル:
elixirc _filename_
実行:
elixir -e Main.main
結果
AC  
実行時間 309 ms / 2,000 ms
+ 331µs
コード長 349 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,309 ms
コンパイル使用メモリ 77,376 KB
実行使用メモリ 67,216 KB
最終ジャッジ日時 2026-09-21 06:13:42
合計ジャッジ時間 31,735 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

defmodule Main do
  def input, do: IO.read(:line) |> String.trim
  def ii, do: input() |> String.to_integer
  def li, do: input() |> String.split |> Enum.map(&String.to_integer/1)

  def main do
    n = ii()

    x = trunc(:math.sqrt(2 * n))
    if 2*n == x*(x+1) do
      IO.puts "YES"
      IO.puts x
    else
      IO.puts "NO"
    end
  end
end
0