Last active
August 29, 2015 14:09
-
-
Save syusui-s/f0ca0a40bd1f1d11d936 to your computer and use it in GitHub Desktop.
「あそこにベンツが停まってますね」 参考: https://twitter.com/rin_eclair/status/534520672848859136 https://twitter.com/To_alpaca/status/534246693923860480
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! ruby -Ku | |
puts "「一日何本くらい煙草をお吸いに?」" | |
print "「N本ですね」: " | |
cigarettes = gets.to_i | |
puts "「喫煙年数は?」" | |
print "「N年です」: " | |
years = gets.to_i | |
print "「あそこにベンツが停まってますね」\n「はい」\n「もし" | |
one_cigarette = 22 # yen | |
bentz_price = 10117800 # 2 * 22 * 365 * (600 + 30) | |
per_year = cigarettes * one_cigarette * 365 | |
result = (bentz_price - years * per_year) / per_year | |
if result < 2 then | |
puts "あなたが煙草を吸わなければ、あれくらい買えたんですよ」" | |
else | |
# あなたが煙草を吸っていなかったら、あと%d年であれくらい買えたんですよ | |
puts "あと%d年タバコを吸わないようにすればあのベンツが買えるんですよ」" % result | |
puts "「%d年」" % result if result > 50 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment