ZOJ 1951 Goldbach's Conjecture(素数打表)
来源:互联网 发布:餐饮软件 编辑:程序博客网 时间:2024/05/19 03:16
#include <cstdio> #include <iostream> #include <cmath> using namespace std; const int maxn=1000010; bool isP[maxn]; int n; void init(){ for(int i=2;i<maxn;++i){ isP[i]=1; } for(int i=2;i<maxn;++i){ if(isP[i]){ for(int j=2;j*i<maxn;++j){ isP[i*j]=0; } } } } int main(){ init(); while(scanf("%d",&n)&&n){ int i; for(i=3;i<=n;++i){ if(isP[i]&&isP[n-i]){ break; } } printf("%d = %d + %d\n",n,i,n-i);} return 0; }
- ZOJ 1951 Goldbach's Conjecture(素数打表)
- Anti-Goldbach's Conjecture 素数打表
- POJ 2262/ ZOJ 1951:Goldbach\'s Conjecture - 筛法打素数表
- HDU 1397 Goldbach's Conjecture(素数打表)
- hdoj 1397 Goldbach's Conjecture (大数素数打表)
- LightOj 1259-Goldbach`s Conjecture(素数打表)
- poj 2262 Goldbach's Conjecture -- 筛法求素数打表
- POJ 2262 Goldbach's Conjecture 素数打表
- Goldbach`s Conjecture (数论,素数打表)
- zoj 1951 Goldbach's Conjecture(素数筛选继续水)
- ZOJ.1951 Goldbach's Conjecture【素数】 2015/09/22
- zoj 1951 Goldbach's Conjecture
- zoj 1951 Goldbach's Conjecture
- POJ 2909 / ZOJ 1657 : Goldbach\'s Conjecture - 筛法打素数表
- POJ 2262 Goldbach's Conjecture(素数表)
- POJ 2909 Goldbach's Conjecture(素数表)
- Goldbach's Conjecture map+素数表
- zoj 1951 Goldbach's Conjecture (水``)
- [IOS ScrollView]--PSCollectionView
- cocos2d
- [CF]292E. Copying Data 分块
- 获取JSON格式字符的处理
- 详解使用PHP CURL访问HTTPS
- ZOJ 1951 Goldbach's Conjecture(素数打表)
- 排序算法之一插入排序
- 模板类
- [IOS 消息提醒]--状态栏FDStatusBarNotifierView
- printf的几种格式
- nyoj 257 郁闷的C小加(一)
- android2.3.5 EVDO拨号APN
- poj_1562Oil Deposits
- 列表视图控件一些函数