2009-01-26から1日間の記事一覧

Rubyで20世紀の日曜日を求める 〜Rubyでオイラープロジェクトを解こう!Problem19

Problem 19 - Project Eulerより You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving …

Rubyで階乗して桁を合計 〜Rubyでオイラープロジェクトを解こう!Problem20

Problem 20 - Project Eulerより n! means n × (n - 1)× ... × 3 × 2 × 1 Find the sum of the digits in the number 100! n!は n × (n - 1)× ... × 3 × 2 × 1を意味する。 100!における桁の合計を求めよ。 Integerクラスのインスタンスメソッドとして !とsu…