結果

問題 No.648  お や す み 
コンテスト
ユーザー norioc
提出日時 2024-11-08 10:08:49
言語 Elixir
(1.19.5)
コンパイル:
elixirc _filename_
実行:
elixir -e Main.main
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 349 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,506 ms
コンパイル使用メモリ 76,304 KB
実行使用メモリ 63,304 KB
最終ジャッジ日時 2026-05-08 16:20:40
合計ジャッジ時間 42,193 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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