Problem 2878 --1.4.4 Mother's Milk

2878: 1.4.4 Mother's Milk

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $8$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 usaco 递归 模拟

Farmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an integer from 1 through 20, inclusive. Initially, buckets A and B are empty while bucket C is full of milk. Sometimes, FJ pours milk from one bucket to another until the second bucket is filled or the first bucket is empty. Once begun, a pour must be completed, of course. Being thrifty, no milk may be tossed out.

Write a program to help FJ determine what amounts of milk he can leave in bucket C when he begins with three buckets as above, pours milk among the buckets for a while, and then notes that bucket A is empty.

PROGRAM NAME: milk3

A single line with the three integers A, B, and C. 

A single line with a sorted list of all the possible amounts of milk that can be in bucket C when bucket A is empty. 

8 9 10
1 2 8 9 10

SAMPLE INPUT (file milk3.in)

2 5 10

SAMPLE OUTPUT (file milk3.out)

5 6 7 8 9 10

推荐代码 查看2878 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 7oby 469901 2019-09-18 12:12:34
内存最少[$1128 $KB] 7oby 469901 2019-09-18 12:12:34
第一AC 计爱玲 447576 2019-07-15 21:11:55
第一挑战 计爱玲 447576 2019-07-15 21:11:55

赛题来源/所属竞赛 usaco training usaco Training

竞赛编号 竞赛名称 竞赛时间 访问比赛
1405 安财贸20190918测试 2019-09-18 09:00:00 请登录