結果

問題 No.71 そろばん
ユーザー DialBird
提出日時 2017-02-20 21:01:31
言語 Ruby
(3.4.1)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 240 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-30 10:54:14
合計ジャッジ時間 4,712 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    @n = gets.to_i
  end

  def run
    max = 0
    0.upto(@n) do |i|
      atai = (i + 1) * (@n - i) + i
      break if atai <= max
      max = atai
    end

    return max
  end
end

puts Yukicoder.new.run
0