问题描述:
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
As 1 = 14 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.
解决问题:
水仙花数。
遍历计算。
public static int find(int number){
int sum =0;
int i;
//pow(9,5)*6
double UP = Math.pow(9, 5)*6;
for( i=4; i<=UP;i++){
int cur =i;
String s = i+"";
int[] num = new int[s.length()];
int index = 0;
while(cur!=0){
num[index] = cur%10;
cur = cur/10;
index++;
}
int result = 0;
for(int j=0; j<num.length; j++){
result += num[j]*num[j]*num[j]*num[j]*num[j];
// System.out.print(num[j]+"_");
}
if(result==i){
System.out.println(i);
sum+=i;
}
}
return sum;
}
分享到:
相关推荐
21.9 Charging related problem 30 21.10 FTP related problem 30 21.11 Command restrict problem 31 22. IOG related problem 31 22.1 Common part 31 22.2 NODE BLOCKED 33 22.3 STS Related Problems 33 22.4 ...
Computer Networking: A Top-Down Approach, 6th Edition Solutions to Review Questions and Problems Version Date: May 2012 ...This document contains the solutions to review questions ...Problem 1 There...
Publication Date: 2015-05-30 ISBN-10: 9814663735 ISBN-13: 9789814663731 The author looks at the issues of how computing are used and taught, with a focus on embedding computers within problem solving...
29. 问题,苦恼 n - problem 30. 〔用手或器具〕击;打 v - hit 31. 立即;马上 - immediately 32. 陷入;参与 - get involved 33. 她自己 pron - herself 34. 绷带 n 用绷带包扎 v - bandage 35. 生病的;有病的 ...
29. 问题,苦恼 n - problem 30. (用手或器具)击;打 v - hit 31. 立即;马上 - immediately 32. 陷入;参与 - get involved 33. 她自己 pron - herself 34. 绷带 n 用绷带包扎 v - bandage 35. 生病的;有病的 ...
苦恼 - problem 30. (用手或器具) 击;打 - hit 31. 立即;马上 - immediately 32. 陷入;参与 - get involved 33. 她自己 - herself 34. 绷带/ 用绷带包扎 - bandage 35. 生病的;有病的 - sick 36. 膝;膝盖 - ...
by the standard IEEE benchmark systems with 14, 30, 57, 118, and 300 buses as well as several randomly generated systems. Since this condition is hard to study, a sufficient zero-duality-gap condition...
此外,从部分内容中可见,研究者Eugeniusz Nowicki和Czeslaw Smutnicki发表的研究成果,在解决特定规模的Job Shop问题方面取得了显著的成效,并在30秒内解决了10x10的标准测试问题。这表明他们的快速禁忌搜索算法...
戴尔PowerEdge T30服务器作为面向小型企业及家庭办公室设计的入门级塔式服务器,以其卓越的计算能力、稳定的运行表现和丰富的存储选项深受用户青睐。而BIOS作为服务器硬件和操作系统沟通的桥梁,其稳定性和兼容性对...
dragons are small, roughly 10 kg, and after a year grow to roughly 30 40 kg. They continue to grow throughout their life depending on the conditions and amount of food available to them.
这是T30没屏蔽m2接口的最后一个bios版本,此版本之后主板m2接口被戴尔官方屏蔽。
1291 pages (December 30, 2016) 出版社: Prentice Hall; 3 edition Language: English ISBN-10: 0131474340 ISBN-13: 9780131474345 Contents Preface. 0. Computers, Objects, and Java. 1. Java Program Design...
GCJ 资格赛 Problem A 30分solution 思路很水,,直接判断10种状态,,详见博客文章
针对2006年MCM Problem A中的问题,我们需要配置这种“手动”灌溉系统,以最小化灌溉80米乘30米的田地所需的时间。任务要求找到一种算法来确定如何灌溉矩形田地,以便牧场主维护灌溉系统所花费的时间最少。田地中...
### Ulam's Problem:在没有反馈的情况下搜索与说谎者博弈 #### 一、问题背景与定义 Ulam的问题起源于斯坦尼斯拉夫·乌拉姆(Stanislaw Ulam)提出的一个智力游戏,该问题涉及到如何在面对可能的谎言回答时确定一...
gnome-shell-3.28.3-30.el7.x86_64.rpm
- **老年阶段**:适宜选择散步、太极、瑜伽等低强度运动,每周至少5次,每次20-30分钟,以增强身体柔韧性和平衡能力。 ### 四、团队健康评分与计划调整 基于建立的模型,可以为团队成员进行健康评分,并根据实际...
txt文件为1985年美赛MCM题目,是A题。 内容是英文的,30行左右。非常好的学习资料,想做A题的可以看看。 希望大家美赛顺利~