project Euler problem 10
来源:互联网 发布:淘宝9.9包邮官网 编辑:程序博客网 时间:2024/05/20 22:37
/** * Created by Administrator on 2015/5/10. */public class E10 { //判断一个数是否是质数 public static boolean isPrime(int x) { boolean isPrime=true; for(int i=2;i<=Math.sqrt(x);i++) if(x%i==0) { isPrime=false; break; } return isPrime; } public static void main(String[] args) { long sum=0;//注意用long 否者会越界 for(int i=2;i<2000000;i++) if(isPrime(i)) sum+=i; System.out.println(sum); }}
0 0
- Project Euler problem 10
- project Euler problem 10
- Project Euler – Problem 10
- 【Project Euler】【Problem 10】Summation of primes
- project euler problem 10:Summation of primes
- Project Euler Problem 10: Summation of primes
- 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 30
- Project Euler Problem 31
- Project Euler Problem 32
- Project Euler Problem 14
- 支付宝手机网页即时到账接口(4)之交易接口服务器异步通知
- 支付宝手机网页即时到账接口(5)之交易接口页面跳转同步通知
- Django TemplateDoesNotExist
- 怪物掉落金币随想
- 天行健,君子以自强不息!
- project Euler problem 10
- RedHat 6.0使用CentOS YUM源更新的方法
- C++ STL泛型编程——在ACM中的运用
- Android xml 小技巧
- 【C/C++】STL学习笔记
- 链接性 杂谈
- 移动应用数据统计分析平台Flurry,Google Analytics
- linux系统硬件配置查看方法
- 排序算法--希尔排序