文件名称:24

  • 所属分类:
  • 其他小程序
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2014-03-11
  • 文件大小:
  • 1kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • Qin****
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

素数距离问题

时间限制:3000 ms | 内存限制:65535 KB

难度:2

描述

现在给出你一些数,要求你写出一个程序,输出这些整数相邻最近的素数,并输出其相距长度。如果左右有等距离长度素数,则输出左侧的值及相应距离。

如果输入的整数本身就是素数,则输出该素数本身,距离输出0

输入

第一行给出测试数据组数N(0<N<=10000)

接下来的N行每行有一个整数M(0<M<1000000),

输出

每行输出两个整数 A B.

其中A表示离相应测试数据最近的素数,B表示其间的距离。

样例输入

3

6

8

10样例输出

5 1

7 1

11 1-Primes distance problem

Time Limit: 3000 ms | Memory Limit: 65535 KB

Difficulty: 2

Descr iption

You are given a couple, ask you to write a program that outputs these integers nearest neighbor primes, and the output of its length apart. If there are equidistant about the length of a prime number, and the corresponding output value from the left.

If the integer input is itself a prime number, then the output of the primes itself from output 0

Enter

The first line gives the number of test data sets N (0 <N <= 10000)

The next N lines contains an integer M (0 <M <1000000),

Export

Each line of the output of two integers A B.

Wherein A represents a corresponding test data from the nearest prime number, B is the distance therebetween.

Sample Input

3

6

8

10 Sample Output

51

71

111
(系统自动生成,下载前可以参看下载内容)

下载文件列表





24.cpp

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org