#P1215. [USACO1.4] 母亲的牛奶 Mother's Milk
[USACO1.4] 母亲的牛奶 Mother's Milk
Description
Farmer John has three buckets with capacities of liters.
Initially, buckets and are empty, and bucket is full of milk. From time to time, the farmer pours milk from one bucket to another until either the receiving bucket is full or the source bucket is empty.
Each pour is complete. No milk is lost.
Write a program to help the farmer find all possible amounts of milk remaining in bucket when bucket is empty.
Input Format
A single line containing three integers .
Output Format
Output a single line listing, in ascending order, all possible amounts of milk in bucket when bucket is empty.
8 9 10
1 2 8 9 10
2 5 10
5 6 7 8 9 10
Hint
Constraints
For of the testdata, .
Problem translation from NOCOW.
USACO Training Section 1.4.
Translated by ChatGPT 5
京公网安备 11011102002149号