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 ...
随机推荐
- 为做个程序员英语字典,我处理了StackOverflow和HackerNews10年5千万条数据
有点标题党,不过都说都真实的.英语技能对开发员人员至关重要.所有人都不喜欢背单词,但更惨的是背住的单词发现没怎么用,又慢慢地忘记了.本来计划给自己做个开发人员常用单词表,感觉可能对其它人也有用,所以就 ...
- laravel 运用.env部署多环境配置
切换到laravel 入口文件bootstrap\app.php 在 return $app; 之上添加: $environmentPath = $app->environmentPath( ...
- input回退禁止
//处理键盘事件 禁止后退键(Backspace)密码或单行.多行文本框除外 function forbidBackSpace(e) { var ev = e || window.event; //获 ...
- Linux将.deb以绿色免安装的方式“安装”
1.如果是xxx.deb文件,一般网上都是教你dkpg -i xxx.deb,但是这种方式类似windows里的安装,可能会在很多地方生成一些“垃圾”数据[比如不需要在dpkg安装应用信息文件里写入此 ...
- QPS、TPS和系统吞吐量
QPS:Queries Per Second,每秒查询率.是一台服务器每秒能够相应的查询次数,是对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准. TPS:Transactions Per ...
- JUC之AbstractQueuedSynchronizer原理分析 - 独占/共享模式
1. 简介 AbstractQueuedSynchronizer (抽象队列同步器,以下简称 AQS)出现在 JDK 1.5 中,由大师 Doug Lea 所创作.AQS 是很多同步器的基础框架. R ...
- QT 设置程序图标
1.应用窗口左上角的图标.状态栏上显示的图标用setWindowIcon()函数: 2.可执行程序的图标设置: (1).右键项目添加一个资源文件 (2).导入.ico文件图标
- Django框架下报的版本问题
报错环境 python=3.6.5,django=2.2,PyMySQL=0.9.3 …… django.core.exceptions.ImproperlyConfigured: mysqlclie ...
- C#中使用XML存储数据
创建XML文档 首先引用System.Xml命名空间 1.初始化一个实例 XmlDocument xd = new XmlDocument(); 2.创建XML头文件声明 XmlDeclaration ...
- AS3动画效果常用公式
缓动公式: sprite.x += (targetX – sprite.x) * easing;//easing为缓动系数变量 sprite.y += (targetY – sprite.y) * e ...