Problem 16 of 2的1000次方
来源:互联网 发布:滬深300指数每日数据 编辑:程序博客网 时间:2024/06/14 00:56
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
http://projecteuler.net/problem=16
import java.math.BigInteger;public class SumDigitsTwo {public static void main(String args[]) {int sum=0;String str=pow("2", 1000);for(int i=0;i<str.length();i++){sum+=Integer.parseInt(str.substring(i,i+1));}System.out.print(sum);}public static String pow(String a,int b){BigInteger bi=new BigInteger(a).pow(1000);return bi.toString();}}
Answer:
1366- Problem 16 of 2的1000次方
- 计算2的1000次方
- 231.Power of Two(2的N次方)
- Power of Two 判断是否为2的次方
- leetcode 231. Power of Two(2的次方)
- poj 2的n次方 http://poj.grids.cn/problem/2809/
- 2的N次方
- 2的幂次方
- 2的任意次方
- 2的N次方
- 2的32次方
- 2的N次方
- 2的n次方
- 2的幂次方
- 2的n次方
- 2的次方(c++)
- 2的n次方
- Power of Four and Power of Three - 4的次方和3的次方
- java 对象序列化
- 珍惜珍惜
- How to see all the application errors related to SQL Server and export them to a .csv file.
- JQuery选择过滤器大全
- 各种字符编码方式详解及由来(ANSI,UNICODE,UTF-8,GB2312,GBK)
- Problem 16 of 2的1000次方
- 从键盘读入两个整数,输出平方和立方值.
- 过滤特殊字符的方法
- cocoa touch是什么?
- windows7 任务栏突然消息
- sql server 多种方式 查找重复记录
- UNICODE,GBK,UTF-8区别
- Linux 中的零拷贝技术,第 1 部分
- 四屏Flash带缩略图焦点图切换效果