結果
| 問題 | 
                            No.115 遠足のおやつ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2014-12-29 00:30:02 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 303 bytes | 
| コンパイル時間 | 136 ms | 
| コンパイル使用メモリ | 7,296 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-11-24 03:08:39 | 
| 合計ジャッジ時間 | 5,067 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 39 WA * 1 | 
コンパイルメッセージ
Main.rb:5: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
n,d,k=gets.split.map(&:to_i)
summin=k*(k+1)/2
summax=summin+(n-k)*k
if summin>d||summax<d||k>n
  p -1
else
  if d==summin
    puts [*1..n]*" "
  elsif d==summax
    puts [*n-k+1..n]*" "
  else
    diff=d-summin
    puts [*1..k-(m=diff/(n-k))-1,k-m+(diff-m*(n-k)),*(k-m+1..k).map{|i|i+n-k}]*" "
  end
end