Comment detail

除算・余剰を使わずに閏年 (Nested Flatten)
正規表現。
1
2
3
4
5
6
def leap?( year )
    return false unless /((^|[02468])[048]|[13579][26])$/.match( year.to_s )
    return true unless /00$/.match( year.to_s )
    return false unless /((^|[02468])[048]|[13579][26])00$/.match( year.to_s )
    return true
end

Index

Feed

Other

Link

Pathtraq

loading...