Goldbach's Conjecture map+素数表
来源:互联网 发布:政府与网络 编辑:程序博客网 时间:2024/05/22 17:15
#include <stdio.h>#include <cstring>#include <iostream>#include <map>using namespace std;const int maxn=1000001;map <int,int> mp;int p[maxn];bool vis[maxn];int t,n;void get_prime(){ memset(vis,false,sizeof(vis)); memset(p,0,sizeof(p)); t=0; for(int i=2; i<=maxn; i++) { { for(int j=i*2; j<=maxn; j+=i) vis[j]=true; } if(!vis[i]) p[t]=i,mp[i]=t,t++; }}int main(){ get_prime(); while(scanf("%d",&n)==1&&n) { bool fuck=false; int ans=0; for(int i=0; i<t; i++) { ans=n-p[i]; if(mp[ans]!=0) { fuck=true; break; } } if(!fuck) printf("Goldbach's conjecture is wrong.\n"); else printf("%d = %d + %d\n",n,n-ans,ans); } return 0;}
- Goldbach's Conjecture map+素数表
- POJ 2262 Goldbach's Conjecture(素数表)
- POJ 2909 Goldbach's Conjecture(素数表)
- Anti-Goldbach's Conjecture 素数打表
- Goldbach`s Conjecture 素数筛选
- ZOJ 1951 Goldbach's Conjecture(素数打表)
- HDU 1397 Goldbach's Conjecture(素数打表)
- POJ 2262/ ZOJ 1951:Goldbach\'s Conjecture - 筛法打素数表
- POJ 2909 / ZOJ 1657 : Goldbach\'s Conjecture - 筛法打素数表
- hdoj 1397 Goldbach's Conjecture (大数素数打表)
- POJ 2262 Goldbach's Conjecture(素数表分解质数)
- LightOj 1259-Goldbach`s Conjecture(素数打表)
- poj 2262 Goldbach's Conjecture -- 筛法求素数打表
- POJ 2262 Goldbach's Conjecture 素数打表
- Goldbach`s Conjecture (数论,素数打表)
- HDOJ 1397 Goldbach's Conjecture [爱沙托散筛法求素数]
- PKU2262 Goldbach's Conjecture 数论-素数
- poj 2262 Goldbach's Conjecture 【素数筛】
- poj1364 - King
- 经典算法书籍推荐
- 轮廓的查找、表达、绘制、特性及匹配(How to Use Contour? Find, Component, Construct, Features & Match)
- 论MMORPG游戏服务器架构
- 图像特征检测(Image Feature Detection)
- Goldbach's Conjecture map+素数表
- 小企业如何消除“成长的烦恼”呢?
- hdu 1281 棋盘游戏
- 我为什么没有加入苹果的iOS APP移动大军?[最近更新:2015-02-03]
- 常见设计模式之【外观模式】
- 找回本机MySQL密码的方法
- Lync Server 2010和Exchange Server 2010 OWA(IM)集成异常
- 33. 实现桌球的反弹
- Oracle Permanent Space Usage Related Queries