{"blog_title":"\u6bdb\u306e\u306f\u3048\u305f\u3088\u3046\u306a\u3082\u306e","url":"https://gomi-box.hatenablog.com/entry/20081026/PE_P20","provider_url":"https://hatena.blog","blog_url":"https://gomi-box.hatenablog.com/","categories":["Ruby","ProjectEuler"],"title":"Problem 20","author_name":"gomi-box","description":"n \u00d7 (n - 1) \u00d7 ... \u00d7 3 \u00d7 2 \u00d7 1 \u3092 n! \u3068\u8868\u3059\u3002100! \u306e\u5404\u6841\u306e\u6570\u5b57\u306e\u5408\u8a08\u3092\u6c42\u3081\u3088\u3002 Problem 20 - PukiWiki def make_array(num) array = [] while num > 0 num,tmp = num.divmod(10) array.unshift(tmp) end return array end sum = 1 (2..100).each{|n| sum = sum * n} ans =0 make_array(sum).each{|i| ans += i} p ans \u7b54\u3048\uff1a648","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fgomi-box.hatenablog.com%2Fentry%2F20081026%2FPE_P20\" title=\"Problem 20 - \u6bdb\u306e\u306f\u3048\u305f\u3088\u3046\u306a\u3082\u306e\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","width":"100%","height":"190","author_url":"https://blog.hatena.ne.jp/gomi-box/","type":"rich","provider_name":"Hatena Blog","published":"2008-10-26 00:00:00","image_url":null}