結果
| 問題 |
No.1337 Fair Otoshidama
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:22:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 975 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 82,336 KB |
| 実行使用メモリ | 53,932 KB |
| 最終ジャッジ日時 | 2025-03-31 17:23:28 |
| 合計ジャッジ時間 | 2,141 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
import math
X, Y, Z = map(int, input().split())
total = 300 + X + Y + Z
if total % 3 != 0:
print("No")
else:
S = total // 3
delta_A = S - (100 + X)
delta_B = S - (100 + Y)
delta_C = S - (100 + Z)
# Compute c_a and c_b with proper ceiling division
def compute_ceil(numerator):
if numerator <= 0:
return 0
return (numerator + 2) // 3 # Equivalent to math.ceil(numerator / 3)
numerator_a = -delta_A
c_a = compute_ceil(numerator_a)
numerator_ab = -(delta_A + delta_B)
c_b = compute_ceil(numerator_ab)
c_min = max(c_a, c_b, 0)
required_parity = (delta_A + delta_B) % 2
current_parity = c_min % 2
if current_parity == required_parity:
c = c_min
else:
c = c_min + 1
# Compute a and b
a = delta_A + 3 * c
b_num = delta_A + delta_B + 3 * c
b = b_num // 2
if a >= 0 and b >= 0 and b_num % 2 == 0:
print("Yes")
else:
print("No")
lam6er