Created
July 22, 2016 00:47
-
-
Save hyuki0000/adcc535e5faa17af8e9f5995ac1f34e8 to your computer and use it in GitHub Desktop.
一年で、月と日の比が円周率に近いのはいつか?
This file contains 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
#!/usr/bin/ruby | |
(1..12).each do |month| | |
(1..31).each do |day| | |
r = (month.to_f / day).to_s | |
s = (day.to_f / month).to_s | |
puts "#{month}月#{day}日 #{month}/#{day} = #{r}" if r.match(/^3\.1/) | |
puts "#{month}月#{day}日 #{day}/#{month} = #{s}" if s.match(/^3\.1/) | |
end | |
end | |
# vim: set filetype=ruby: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment