結果
| 問題 | No.115 遠足のおやつ |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-28 09:51:22 |
| 言語 | Ruby (3.4.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 429 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-25 13:03:47 |
| 合計ジャッジ時間 | 5,842 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 WA * 1 RE * 3 |
コンパイルメッセージ
Main.rb:9: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:39: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
n,d,k=gets.split.map{|e| e.to_i}
x=[]
sum=0
k.times{|i|
x<<i+1
sum+=(i+1)
}
if d<sum
puts -1
elsif d==sum
puts arr*" "
else
k.times{|i|
p1=k-i-1
while true
if sum==d
break
end
if p1==k-1
if x[p1]==n
break
end
else
if x[p1]+1==x[p1+1]
break
end
end
sum+=1
x[p1]+=1
if sum==d
break
end
end
break if sum==d
}
if sum==d
puts x*" "
else
puts -1
end
end
horiesiniti