結果
| 問題 |
No.1337 Fair Otoshidama
|
| コンテスト | |
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2025-04-30 09:57:37 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 662 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 8,064 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2025-04-30 09:57:42 |
| 合計ジャッジ時間 | 2,882 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 10 WA * 10 |
コンパイルメッセージ
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.chomp
end
Start.new.main
toshiro_yanagi