結果
| 問題 | 
                            No.115 遠足のおやつ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2014-12-29 01:18:33 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 88 ms / 5,000 ms | 
| コード長 | 254 bytes | 
| コンパイル時間 | 347 ms | 
| コンパイル使用メモリ | 7,936 KB | 
| 実行使用メモリ | 13,056 KB | 
| 最終ジャッジ日時 | 2025-01-03 01:01:02 | 
| 合計ジャッジ時間 | 4,983 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-` operator Syntax OK
ソースコード
n,d,k=gets.split.map(&:to_i)
t=n-k
min=k*(k+1)/2
max=min+t*k
if min>d||max<d||k>n
  p -1
else
  if d==min
    puts [*1..k]*" "
  elsif d==max
    puts [*n-k+1..n]*" "
  else
    dif=d-min
    puts [*1..k-(m=dif/t)-1,k-m+(dif-m*t),*n-m+1..n]*" "
  end
end