zoj 4099 Extended Twin Composite Number
Do you know the twin prime conjecture? Two primes and are called twin primes if . The twin prime conjecture is an unsolved problem in mathematics, which asks for a proof or a disproof for the statement "there are infinitely many twin primes".
On April 17, 2013, Yitang Zhang announced a proof that for some integer that is less than 70 million, there are infinitely many pairs of primes that differ by . As of April 14, 2014, one year after Zhang's announcement, the bound has been reduced to 246. People are hoping for the bound to be smaller and smaller, so that a proof for the conjecture can finally be found.
For our dear contestants, we've prepared another similar problem for you, which is the extended twin composite number problem: Given a positive integer , find two integers and such that and both and are composite numbers.
Input
There are multiple test cases. The first line of the input contains an integer (about ), indicating the number of test cases. For each test case:
The only line contains one integer ().
Output
For each test case output two integers in one line, indicating and where . If there are multiple valid answers, you can print any of them; If there is no valid answer, output "-1" (without quotes) instead.
Sample Input
3
11
1805296
5567765
Sample Output
4 15
114514 1919810
111234 5678999
Author: JIN, Mengge
Source: The 19th Zhejiang University Programming Contest Sponsored by TuSimple
水题,特别能迷惑人。
代码:
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring> using namespace std; int main() {
int t,n;
scanf("%d",&t);
while(t --) {
scanf("%d",&n);
if(n == ) printf("%lld %lld\n",,);
else printf("%lld %lld\n",n * 2ll,n * 3ll);
}
}
zoj 4099 Extended Twin Composite Number的更多相关文章
- 2019浙大校赛--J--Extended Twin Composite Number(毒瘤水题)
毒瘤出题人,坑了我们好久,从基本的素数筛选,到埃氏筛法,到随机数快速素数判定,到费马小定理,好好的水题做成了数论题. 结果答案是 2*n=n+3*n,特判1,2. 以下为毒瘤题目: 题目大意: 输入一 ...
- ZOJ 2971 Give Me the Number;ZOJ 2311 Inglish-Number Translator (字符处理,防空行,strstr)
ZOJ 2971 Give Me the Number 题目 ZOJ 2311 Inglish-Number Translator 题目 //两者题目差不多,细节有点点不一样,因为不是一起做的,所以处 ...
- ZOJ 2059 The Twin Towers(双塔DP)
The Twin Towers Time Limit: 2 Seconds Memory Limit: 65536 KB Twin towers we see you standing ta ...
- ZOJ 2971 Give Me the Number
Give Me the Number Numbers in English are written down in the following way (only numbers less than ...
- ZOJ 2971 Give Me the Number (模拟,字符数组的清空+map)
Give Me the Number Time Limit: 2 Seconds Memory Limit: 65536 KB Numbers in English are written ...
- ZOJ 2059 The Twin Towers
双塔DP. dp[i][j]表示前i个物品,分成两堆(可以不全用),价值之差为j的时候,较小一堆的价值为dp[i][j]. #include<cstdio> #include<cst ...
- ZOJ 2132 The Most Frequent Number (贪心)
题意:给定一个序列,里面有一个数字出现了超过 n / 2,问你是哪个数字,但是内存只有 1 M. 析:首先不能开数组,其实也是可以的了,后台数据没有那么大,每次申请内存就可以过了.正解应该是贪心,模拟 ...
- ZOJ - 2132:The Most Frequent Number(思维题)
pro:给定N个数的数组a[],其中一个数X的出现次数大于N/2,求X,空间很小. sol:不能用保存数组,考虑其他做法. 由于出现次数较多,我们维护一个栈,栈中的数字相同,所以我们记录栈的元素和个数 ...
- The 19th Zhejiang University Programming Contest Sponsored by TuSimple (Mirror)
http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=391 A Thanks, TuSimple! Time ...
随机推荐
- The underlying connection was closed: The connection was closed unexpectedly.
基础连接已经关闭: 连接被意外关闭. 基础连接已经关闭: 发送时发生错误 防火墙问题.或是杀毒软件,卫士之类的.(360 卸载 )
- 推荐Pi(π)币,相当于比特币手机挖矿版
我为什么推荐这个? 说实话,之所以发出来还是因为如果用我的邀请码注册,双方的挖矿速度都会增加些,我的邀请码:leneing,有问题可以咨询我. Pi币简介 1.在这里强烈推荐Pi币,相当于比特币手机挖 ...
- SpringBoot里自定义banner
国外有一个专门用来生成banner的网址:http://patorjk.com/software/taag ,打开这个网址,生成你想要的字儿. 生成时,我们可以选择自己喜欢的字体等信息. 完成后,选择 ...
- jira常用配置
1.关闭注册入口 系统->一般配置->运行模式:私有 2.分享给用户组是,看不到部分用户组的时候,只需要把你的账号添加该分组即可. 3.为项目分配权限,问题-->问题属性——> ...
- git的基本使用流程
1. 在远端创建代码仓库 2. 拉取到本地 git clone $(path) #其中,path包括git路径或者https路径,可通过实际情况进行拉取.另外,可通过-b参数指定拉取的分支,默认拉取m ...
- samtools获取uniq reads
参考地址: https://www.biostars.org/p/56246/ -q INT only include reads with mapping quality >= INT [0] ...
- Deepin安装前分区总结
linux的分区的概念应该这么理解,为某个目录创建/挂载分区,比如为/home创建/挂载到某个分区上: 1.需要/boot分区,1.5G: 2./分区,100G:[会自动创建其他目录如/srv,/ro ...
- JWT知识整理
JSON Web Token:(https://jwt.io/) JSON Web Token(JWT)是一个开放式标准(RFC 7519),它定义了一种紧凑(Compact)且自包含(Self-co ...
- 创建线程的三种方式(Thread、Runnable、Callable)
方式一:继承Thread类实现多线程: 1. 在Java中负责实现线程功能的类是java.lang.Thread 类. 2. 可以通过创建 Thread的实例来创建新的线程. 3. 每个线程都是通过某 ...
- Mybatis之关联关系(一对多、多对多)
目的: Mybatis关系映射之一对多 Mybatis关系映射之多对多 Mybatis关系映射之一对多 一对多 (订单对应多个订单项) 多对一 (订单项对应一个订单) 其是映射关系的基层思维是一样的 ...