project euler problem 30
来源:互联网 发布:数据库primary key 编辑:程序博客网 时间:2024/05/04 11:22
Digit fifth powers
Problem 30
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.
题意:求各位数字的5次方之和与原数是否相同,相同则加起来,最后其和为多少?
暴力解决……
#include <iostream>#include <map>#include <deque>#include <queue>#include <stack>#include <string>#include <cstring>#include <cstdio>#include <cmath>#include <algorithm>#include <map>#include <set>using namespace std;int main(){ int i,j,n,sum,sum1=0; for(n=2;n<=10000000;n++) { j=n; sum=0; while(j) { int t=j%10; sum+=t*t*t*t*t; j/=10; } if(sum==n) sum1+=sum; } cout<<sum1<<endl; return 0;}
- Project Euler Problem 30
- Project Euler - Problem 30
- Project Euler problem 30
- project euler problem 30
- Project Euler Problem 30
- Project euler problem 21 - 30
- Project Euler:Problem 30 Digit fifth powers
- Euler Project Problem 6
- project euler problem 11
- Project Euler Problem 81
- Project Euler Problem 60
- Project Euler Problem 59
- Project Euler Problem 58
- Project Euler Problem 57
- Project Euler Problem 16
- Project Euler Problem 31
- Project Euler Problem 32
- Project Euler Problem 14
- C#调用C++方法,C#使用c++方法返回类或结构体
- 131020
- 电商2
- Mini-project # 1 - Rock-paper-scissors-lizard-Spock
- 黑马程序员----踏踏实实字符串的处理以及一些常用到的方法
- project euler problem 30
- APP被苹果APPStore拒绝的各种原因
- 打开/关闭 HP超极本鼠标触摸板
- 工作那些事(十二)如果哪一天,没有了电脑
- 2013福布斯中国富豪榜:李彦宏第三、马化腾第五、马云第八
- QT线程使用收集示例
- lightoj 1007 - Mathematically Hard 欧拉函数
- Java获取年月日和时分秒
- 修改UITableViewStyleGrouped形式的tableview的背景色