简单题

 #include <iostream>
 #include <stdio.h>
 #include <string>
 #include <stack>
 #include <map>
 #include <vector>
 #include <algorithm>
 using namespace std;

 bool isPrime(int n) {
     ) return true;
      ==  || n == ) return false;
     ; i*i <= n; ++i) {
         ) return false;
     }
     return true;
 }

 int main()
 {
     int N;
     while (cin >> N && N) {
         bool flag = false;
         ; i <= N/; i+=) {
             if (isPrime(i) && isPrime(N-i)) {
                 flag = true;
                 cout << N << " = " << i << " + " << N-i << endl;
                 break;
             }
         }
         if (!flag) cout << "Goldbach's conjecture is wrong." << endl;
     }

     ;
 }

poj: 2262的更多相关文章

  1. POJ 2262 Goldbach&#39;s Conjecture(素数相关)

    POJ 2262 Goldbach's Conjecture(素数相关) http://poj.org/problem?id=2262 题意: 给你一个[6,1000000]范围内的偶数,要你将它表示 ...

  2. POJ中和质数相关的三个例题(POJ 2262、POJ 2739、POJ 3006)

    质数(prime number)又称素数,有无限个.一个大于1的自然数,除了1和它本身外,不能被其他自然数整除,换句话说就是该数除了1和它本身以外不再有其他的因数:否则称为合数.      最小的质数 ...

  3. POJ 2262 Goldbach's Conjecture 数学常识 难度:0

    题目链接:http://poj.org/problem?id=2262 哥德巴赫猜想肯定是正确的 思路: 筛出n范围内的所有奇质数,对每组数据试过一遍即可, 为满足b-a取最大,a取最小 时空复杂度分 ...

  4. Poj 2262 / OpenJudge 2262 Goldbach's Conjecture

    1.Link: http://poj.org/problem?id=2262 http://bailian.openjudge.cn/practice/2262 2.Content: Goldbach ...

  5. poj 2262 Goldbach's Conjecture(素数筛选法)

    http://poj.org/problem?id=2262 Goldbach's Conjecture Time Limit: 1000MS   Memory Limit: 65536K Total ...

  6. POJ 2262 Goldbach's Conjecture(Eratosthenes筛法)

    http://poj.org/problem?id=2262 题意: 哥德巴赫猜想,把一个数用两个奇素数表示出来. 思路:先用Eratosthenes筛法打个素数表,之后枚举即可. #include& ...

  7. poj 2262 Goldbach's Conjecture——筛质数(水!)

    题目:http://poj.org/problem?id=2262 大水题的筛质数. #include<iostream> #include<cstdio> #include& ...

  8. poj 2262【素数表的应用---判断素数】【哈希】

    Goldbach's Conjecture Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 35214   Accepted: ...

  9. Goldbach's Conjecture POJ - 2262 线性欧拉筛水题 哥德巴赫猜想

    题意 哥德巴赫猜想:任一大于2的数都可以分为两个质数之和 给一个n 分成两个质数之和 线行筛打表即可 可以拿一个数组当桶标记一下a[i]  i这个数是不是素数  在线性筛后面加个装桶循环即可 #inc ...

随机推荐

  1. Linux的权限说明

    Linux的权限不是很细致,只有RWX三种r(Read,读取):对文件而言,具有读取文件内容的权限:对目录来说,具有浏览目录的权限.w(Write,写入):对文件而言,具有新增,修改,删除文件内容的权 ...

  2. 文件管理php代码操作文件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. 蓝牙4.0的LM层说明

    1.概念 The Link Manager Protocol (LMP) is used to control and negotiate all aspects of the operation o ...

  4. Qt 自定义 滚动条 样式(模仿QQ)

    今天是时候把软件中的进度条给美化美化了,最初的想法就是仿照QQ. 先前的进度条是这样,默认的总是很难受欢迎的:美化之后的是这样,怎么样?稍微好看一点点了吧,最后告诉你实现这个简单的效果在Qt只需要加几 ...

  5. 【Android测试】【第六节】Monkey——认识和使用

    ◆版权声明:本文出自carter_dream的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4688880.html 自动化工具 接触安 ...

  6. CSS3新添加的选择器

    ---条件选择器:--- .ccc[cusid*= value] { backgroud-color:#0094ff; } //表示使用了class="ccc"元素自定义属性cus ...

  7. pod setup》error: RPC failed; result=18, HTTP code = 200

    Try reducing the postBuffer size in the remote repository config. Follow the steps below Go to remot ...

  8. Arcgis for JS之Cluster聚类分析的实现

    原文:Arcgis for JS之Cluster聚类分析的实现 在做项目的时候,碰见了这样一个问题:给地图上标注点对象,数据是从数据库来 的,包含XY坐标信息的,通过graphic和graphicla ...

  9. 《JAVA NIO》Channel

    3.通道 Channle主要分为两类:File操作对应的FIleChannel和Stream操作对应的socket的3个channe. 1.这3个channel都是抽象类.其具体实现在SPI里面. 2 ...

  10. java.lang.NoClassDefFoundError: Could not initialize class ......

    在测试数据字典工具类的时候一直报这个错误,找了好久,原来是SpringContextUtils这个类没有放入到容器中. 但是我在SpringContextUtils上面加了注解的,为什么注解没有扫到呢 ...