bilingual-math-code-verification-v1 / code /math_code_001_solution.py
efe-T's picture
Upload folder using huggingface_hub
93237a0 verified
Raw History Blame Contribute Delete
513 Bytes
from fractions import Fraction
total = Fraction(20)
low, high, target = Fraction(1, 10), Fraction(3, 10), Fraction(18, 100)
y = total * (target - low) / (high - low)
x = total - y
salt = low * x + high * y
remaining = total - 2
assert x >= 0 and y >= 0 and x + y == total
assert salt == total * target
assert remaining - salt == total - salt - 2
result = {"low_kg": str(x), "high_kg": str(y), "final_salt_fraction": str(salt / remaining)}
import json
print(json.dumps(result, ensure_ascii=False, sort_keys=True))