首页 > 其他 > 详细

ural 1437. Gasoline Station

时间:2015-11-19 22:39:08      阅读:368      评论:0      收藏:0      [点我收藏+]

1437. Gasoline Station

Time limit: 1.0 second
Memory limit: 64 MB
Once a gasoline meter broke at a filling station. Fortunately, there was an overflow clipper (a device that makes it possible not to overfill a tank).
An ACM-programmer came to this station and saw an announcement saying that the station didn‘t work properly. As he was meditating on what to do next, he noticed three empty cans at the station‘s counter. He thought: "If I fill the first can and then empty it to the second one, and then take the third one… Maybe, I‘ll be able to measure out the needed amount of gasoline?"
As usual, he began to think about a general formulation of the problem, forgetting the partial case: "How many different capacities can I measure out using these cans?"
Of course, it is forbidden to spill gasoline because of ecology reasons. Also, the station‘s owner requires that gasoline only be transferred from the storage tank to a can or between cans. The car‘s tank may be filled from one or several of the cans only after all of the transfers.

Input

Each of the three input lines contains an integer from 0 to 255, which is the capacity of a gasoline can in liters.

Output

The result is an integer that is the number of different answers to the question how many liters the programmer can measure out using the gasoline cans with the specified capacities.

Sample

inputoutput
0 
3
4
6

Notes

There is no sense to measure out 0 liters, so this value must not be counted.
Problem Author: Alexey Lakhtin
Problem Source: The 7th USU Open Personal Contest - February 25, 2006

ural 1437. Gasoline Station

原文:http://www.cnblogs.com/StupidBoy/p/4979129.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!