Skip to content

Instantly share code, notes, and snippets.

@sasamijp
Last active August 29, 2015 13:56
Show Gist options
  • Save sasamijp/9225297 to your computer and use it in GitHub Desktop.
Save sasamijp/9225297 to your computer and use it in GitHub Desktop.
トイレ行きたい
# -*- 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