結果

問題 No.115 遠足のおやつ
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-02-27 10:36:59
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-21 16:48:43
合計ジャッジ時間 5,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 89 ms
12,160 KB
testcase_03 WA -
testcase_04 AC 93 ms
12,288 KB
testcase_05 AC 89 ms
12,288 KB
testcase_06 AC 90 ms
12,160 KB
testcase_07 AC 89 ms
12,288 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 89 ms
12,288 KB
testcase_14 AC 90 ms
12,416 KB
testcase_15 AC 90 ms
12,160 KB
testcase_16 AC 91 ms
12,288 KB
testcase_17 AC 89 ms
12,288 KB
testcase_18 AC 91 ms
12,160 KB
testcase_19 AC 89 ms
12,160 KB
testcase_20 AC 89 ms
12,160 KB
testcase_21 AC 89 ms
12,416 KB
testcase_22 AC 88 ms
12,160 KB
testcase_23 WA -
testcase_24 AC 89 ms
12,160 KB
testcase_25 AC 91 ms
12,160 KB
testcase_26 AC 90 ms
12,160 KB
testcase_27 AC 89 ms
12,160 KB
testcase_28 AC 89 ms
12,288 KB
testcase_29 AC 89 ms
12,288 KB
testcase_30 AC 89 ms
12,160 KB
testcase_31 AC 88 ms
12,160 KB
testcase_32 AC 89 ms
12,160 KB
testcase_33 AC 88 ms
12,032 KB
testcase_34 AC 91 ms
12,288 KB
testcase_35 AC 89 ms
12,288 KB
testcase_36 AC 89 ms
12,288 KB
testcase_37 AC 89 ms
12,160 KB
testcase_38 AC 90 ms
12,160 KB
testcase_39 WA -
testcase_40 AC 92 ms
12,288 KB
testcase_41 AC 92 ms
12,288 KB
testcase_42 AC 92 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def min(a,b); a < b ? a : b; end
N, D, K = gets.split.map(&:to_i)
ANS = Array.new(K){|i| K - i }
K.times.inject(D) do |d, i|
  r = K - i
  sum = r * (r + 1) / 2
  if sum > d
    ANS.clear
    ANS << -1
    break
  else
    ANS[i] += min(d - sum, N - K)
    d - ANS[i]
  end
end
puts ANS.reverse.join(' ')
0