Last active
August 29, 2015 13:56
-
-
Save sasamijp/9225297 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
# -*- encoding: utf-8 -*- | |
def datetoDay(str) | |
inputs = str.split | |
y = inputs[0].to_i | |
m = inputs[1].to_i | |
d = inputs[2].to_i | |
if m < 3 | |
y -= 1 | |
m += 12 | |
end | |
return ["にちようび","げつようび","かようび","すいようび","もくようび","きんようび","どようび"][(365 * y + y / 4 - y / 100 + y / 400 + 306 * (m + 1) / 10 + d - 428)%7] | |
end | |
puts datetoDay(gets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment