哥德巴赫猜想(POJ_2262)
2013-04-18 16:23
239 查看
Goldbach's Conjecture
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 32670 | Accepted: 12565 |
8 = 3 + 5 20 = 3 + 17 42 = 5 + 37
#include "stdio.h"int n;int i ,j ;const int max = 1000001;bool flag[max];void creatPrime(){ for(i=1 ; i<=max ; i++) flag[i] = true; flag[1]=false; for(i=2 ; i<=max ;i++) if(flag[i]) for(j = 2*i ; j<=max ; j+=i) flag[j] = false; }int main(int argc, char* argv[]){ creatPrime(); while(scanf("%d",&n)!=EOF) { if(n==0) break; for(i= 2;i<=n/2;i++) if(flag[i]&&flag[n-i]) { printf("%d = %d + %d\n",n,i,n-i); break; } } return 0;}
相关文章推荐
- POJ 2262 Goldbach's Conjecture(哥德巴赫猜想)
- POJ 2262 哥德巴赫猜想证明与素数筛选
- POJ 2262 / UVa 543 - Goldbach's Conjecture (哥德巴赫猜想)
- POJ 2262 Goldbach's Conjecture 哥德巴赫猜想
- poj_2262_Goldbach's Conjecture(哥德巴赫猜想)
- 【POJ】2262-哥德巴赫猜想
- poj 2262 Goldbach's Conjecture 筛法 哥德巴赫猜想
- poj 2262 Goldbach's Conjecture(素数筛选法)
- POJ 2262 Goldbach's Conjecture 数论
- Poj 2262 Goldbach's Conjecture
- POJ 2262 Goldbach's Conjecture
- poj 2262
- poj 2262 Goldbach's Conjecture
- poj 2262 Goldbach's Conjecture
- POJ&nbsp;2262
- poj2262
- poj 2262 Goldbach's Conjecture
- POJ2262
- POJ 2262 Goldbach's Conjecture ( 筛选法求素数 )
- poj解题报告——2262