projecteuler---->problem=34----Digit factorials
Problem 34
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
puts (0..50000).select{|i|
i.to_s.length>1 && i == i.to_s.each_char.map{|d| (1..d.to_i).reduce(1,:*)}.reduce(:+)}.reduce(:+)
版权声明:本文博客原创文章,博客,未经同意,不得转载。
projecteuler---->problem=34----Digit factorials的更多相关文章
- Project Euler:Problem 34 Digit factorials
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are ...
- Project Euler 34 Digit factorials
题意:判断一个数 N 的各个位数阶乘之和是否为其本身,找出所有符合要求的数然后求和 思路:此题思路跟 30 题相同,找到枚举上界 10 ^ n <= 9! × n ,符合要求的 n < 6 ...
- Problem 34
Problem 34 https://projecteuler.net/problem=34 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 1 ...
- (Problem 34)Digit factorials
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are ...
- TJU Problem 2857 Digit Sorting
原题: 2857. Digit Sorting Time Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 3234 Accepted ...
- Project Euler:Problem 33 Digit cancelling fractions
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplif ...
- Project Euler Problem 16-Power digit sum
直接python搞过.没啥好办法.看了下别人做的,多数也是大数乘法搞过. 如果用大数做的话,c++写的话,fft优化大数乘法,然后快速幂一下就好了.
- Problem 30
Problem 30 https://projecteuler.net/problem=30 Surprisingly there are only three numbers that can be ...
- Problem 63
Problem 63 https://projecteuler.net/problem=63 Powerful digit counts The 5-digit number, 16807=75, i ...
随机推荐
- MIPS台OpenWrt在系统内的路由器Rust应用程序开发
笔者:Liigo(庄小莉) 迄今:2014年9一个月17日本 (9一个月29日更新,11一个月19日本再次更新.在最后可用更新) 原文链接:http://blog.csdn.net/liigo/art ...
- 机械革命X5(MECHREVO MR-X5)开包检验
不废话.直接的问题,左右X5没有更具体的信息.为了通过有机会了解后续的选择,具体的数据被释放约: 首先看包装: 1.快递包裹,基于卖方这可以是不同的,包装各不相同 watermark/2/text/a ...
- zerglurker的c语言教程006——第一功能
行,以往的经验教训后,.成员main性能.变数.命名等基本概念应该有一个初步的了解 下面,我们就可以开始我们自己的第一个定义的函数. 仿照头等舱.操作的第二个教训.添加一个新的项目的解决方案Lessi ...
- 移动web:转盘抽奖(幸运大转盘)
为了获取客户.回馈客户,平台一般会推出抽奖活动类的营销页.因此web页面中,有各式各样的抽奖效果. 格子式(九宫格),背景滚动式(数字/文字/图案),旋转式(转盘),游戏式(砸蛋/拼图...).... ...
- 认识Backbone (二)
Backbone.Model(模型) Models(模型)是任何Javascript应用的核心,包括数据交互及与其相关的大量逻辑: 转换.验证.计算属性和访问控制.Model在Backbone中为数据 ...
- QUIC简要
QUIC.即Quick UDP Internet Connection,类似于SPDY,相同也是由Google公司在现有已存协议之上进行了扩展设计,而旨在降低网络延迟.之前我曾介绍过SPDY的相关信息 ...
- POJ 1659 Frogs' Neighborhood(度序列组成)
意甲冠军 中国 依据Havel-Hakimi定理构图即可咯 先把顶点按度数从大到小排序 可图的话 度数大的顶点与它后面的度数个顶点相连肯定是满足的 出现了-1就说明不可图了 #include ...
- bat(批处理文件)初步 第一篇 基本符号
近期我使用的一款软件中须要大量的环境变量设置,而我又不想讲这些变量都加入到系统的环境变量中,一方面是由于有一些同名的库文件的版本号却不一样,都 写在系统环境中会相互干扰:还有一方面则是大部分的路径仅仅 ...
- Java String 类的 equals 和 ==
public class Test_String { public static void main(String[] args) { String a = new String("aa&q ...
- CodeForces 482C Game with Strings
意甲冠军: n一定长度m串 隐藏的字符串相等的概率 然后,你猜怎么着玩家隐藏的字符串 的询问字符串的一个位置 再不断的知道一些位置后 游戏者就能够确定藏起来的串是什么 问 游戏者的期望步 ...