結果
問題 |
No.1337 Fair Otoshidama
|
ユーザー |
![]() |
提出日時 | 2025-04-30 09:56:57 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 2,090 ms |
コンパイル使用メモリ | 8,100 KB |
実行使用メモリ | 20,224 KB |
最終ジャッジ日時 | 2025-04-30 09:57:12 |
合計ジャッジ時間 | 4,395 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
class Start def main a = input.split.map { |s| s.to_i + 100 } echo func(a) ? "Yes" : "No" return nil end private def func(a) result = false #return result if a.sum % 3 != 0 #echo "j, target, x ,a" for i in 0...4 k = [0, a.min - 3].max a = a.map { |x| x - k } a = sub(a, i % 3) end result = true if a.sum % 9 == 0 result end def sub(a, i) target = a.sum / 3 j = 1 + i x = [a[j % 3] - target, 0].max / j * j a[i] += x a[j % 3] -= x #echo [j, target, x, a] return a end def echo(*x) print(*x) puts end def input = $gets.pop.chomp end Start.new.main