zoukankan      html  css  js  c++  java
  • 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 == 1) printf("%lld %lld
    ",8,9);
            else printf("%lld %lld
    ",n * 2ll,n * 3ll);
        }
    }
  • 相关阅读:
    二进制运算基础
    初识Tomcat系统架构
    MySQL InnoDB引擎锁的总结
    Java并发编程:并发容器之CopyOnWriteArrayList
    java类的加载机制
    Nginx实现tomcat集群进行负载均衡
    Java序列化对象为字符串并将字符串反序列化为对象
    数据库的四大特性及事务的隔离级别
    人性的弱点
    华为工作法摘抄笔记
  • 原文地址:https://www.cnblogs.com/8023spz/p/10799680.html
Copyright © 2011-2022 走看看