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 ...
随机推荐
- adb(Andorid Debug Bridge)安装和使用
以下是adb工具包最新2017Google官方版下载地址: ADB和Fastboot for Windows https://dl.google.com/android/repository/plat ...
- k8s调度器之亲和性和反亲和性/节点选择器
容器在节点(物理机)上是如何部署的 是由调度器scheduler进行调度的 调度策略 随机 通过节点选择器选择某些节点 通过节点亲和性和pod的亲和性及反亲和性实现更细粒度的控制 参考 https:/ ...
- windows下 pip下载包到指定目录
pip download -r requirements.txt -d G:\PythonVirtualenv\packages python setup.py install
- mongodb4.0 安装
下载: wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.9.tgz 解压缩 tar -zxvf mongodb-linux ...
- CentOS 7 搭建 GitLab
概述 GitLab 是我在日常工作中使用的代码仓库管理系统,它带有非常友好的 Web 界面,并且功能丰富.下面将介绍我在 CentOS 7 上搭建 GitLab 的步骤,以及遇到的一些问题. 关于不同 ...
- Appium移动自动化测试-----(五)python-client安装与测试
前提条件 当你点击这一章时,说明你是打算使用 Python 语言编写 appium 自动化测试脚本的. 1.安装 Python 语言 , Python的安装相对相简单得多. 2.Python 编辑器很 ...
- 使用video.js 7在html中播放rtmp视频流
1.背景 最近要做摄像头视频的展示,不想使用硬件方的专用插件,所以计划视频推送到SRS服务器,浏览器再通过rtmp协议显示,类似于直播. 经查询,了解到可以用ckplayer(有许可条款)和video ...
- java学习笔记(6)-多线程(1)
标签(空格分隔): 笔记 一.基本概念 1.1 程序.进程.线程 程序(program):是为完成特定任务.用某种语言编写的一组指令的集合.即指一段静态的代码,静态对象. 进程(process):是程 ...
- (二)spring Security 自定义登录页面与校验用户
文章目录 配置 security 配置下 MVC 自定义登录页面 自定义一个登陆成功欢迎页面 效果图 小结: 使用 Spring Boot 的快速创建项目功能,勾选上本篇博客需要的功能:web,sec ...
- 机器学习之Adaboost与XGBoost笔记
提升的概念 提升是一个机器学习技术,可以用于回归和分类问题,它每一步产生一个弱预测模型(如决策树),并加权累加到总模型中:如果每一步的弱预测模型生成都是依据损失函数的梯度方向,则称之为梯度提升(Gra ...