Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %lld & %llu

Submit
Status

Description

Final Pan likes prime numbers very much.

One day, he want to find the super prime numbers.A prime numbers $n$($n$>4) is a super prime number only if $n$-4 and $n$+4 are both prime numbers,too.

Your task is really easy:Give $N$,find the maximum super prime number $n$ that $n$<=$N$.

Input

Only one integer $N.( 4<N<10^{12} )$

Output

If there is no such interger $n$,print'$-1$',otherwise print $n$.

Sample Input

8

Sample Output

7

Hint

Source

第七届ACM趣味程序设计竞赛第四场(正式赛)

这一个估计就是最水的的了,找到规律之后判断一下就好

#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
long long n;
while(scanf("%lld",&n)!=EOF)
{
if(n<7)
printf("-1\n");
else
printf("7\n");
}
return 0;
}

UESTC--1272--Final Pan's prime numbers(水题)的更多相关文章

  1. UESTC 1272 Final Pan's prime numbers(乱搞)

    题目链接 Description Final Pan likes prime numbers very much. One day, he want to find the super prime n ...

  2. CDOJ 1272 Final Pan's prime numbers

    有些问题,不做实践与猜测,可能一辈子也想不出答案,例如这题. #include<stdio.h> #include<math.h> long long x; int main( ...

  3. POJ.2739 Sum of Consecutive Prime Numbers(水)

    POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> # ...

  4. VK Cup 2016 - Qualification Round 2 A. Home Numbers 水题

    A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of ...

  5. Codeforces Round #310 (Div. 2) B. Case of Fake Numbers 水题

    B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  6. hdu 5272 Dylans loves numbers 水题

    Dylans loves numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem. ...

  7. Codeforces Round #358 (Div. 2) A. Alyona and Numbers 水题

    A. Alyona and Numbers 题目连接: http://www.codeforces.com/contest/682/problem/A Description After finish ...

  8. Educational Codeforces Round 13 A. Johny Likes Numbers 水题

    A. Johny Likes Numbers 题目连接: http://www.codeforces.com/contest/678/problem/A Description Johny likes ...

  9. Codeforces Round #356 (Div. 2) C. Bear and Prime 100 水题

    C. Bear and Prime 100 题目连接: http://www.codeforces.com/contest/680/problem/C Description This is an i ...

随机推荐

  1. Gerapy 使用详解

    https://blog.csdn.net/fengltxx/article/details/79894839

  2. LeetCode Weekly Contest 24

    1, 543. Diameter of Binary Tree 维护左右子树的高度,同时更新结果,返回以该节点结束的最大长度.递归调用. /** * Definition for a binary t ...

  3. git window端工具之sourcetree使用

    https://www.jianshu.com/p/3478e2a214a1

  4. Linq怎么支持Monad

    在上一篇创建了我们的第一个Monad, Identity<T>. 我们确定了类型要变成Monad, 它必须有一个type constructor(Identity<T>), 和 ...

  5. meta标签的作用及整理

    [转载] meta的标签的使用是我在前端学习中曾经困惑过一段时间的问题.一方面不是很了解meta标签的用途,另一方面是对于meta标签里的属性和值不是懂,也不知道从哪里冒出来的,所以这篇文章专门整理下 ...

  6. Bin文件

    那什么是bin文件呢?为什么这么关键? bin (binary)既是:二进制, 里面存放的一般是可执行的二进制文件.二进制即是机器代码,汇编语言编译后的结果.我们编译的是高级语言,把高级语言翻译为机器 ...

  7. Sql Server 优化----SQL语句的执行方式与锁以及阻塞的关系

    阻塞原因之一是不同的Session在访问同一张表的时候因为不兼容锁的原因造成的, 当前执行的SQL语句是否被阻塞(或者死锁),不仅跟当前表上的已有的锁有关,也会跟当前执行的SQL语句的执行方式有关 简 ...

  8. nodejs supervisor安装

    使用supervisor提高nodejs调试效率 用超级用户运行npm -g install supervisor命令,说是顺 >$ sudo npm -g install supervisor ...

  9. Android对手尽皆铩羽,鸿蒙如何绝地求生?

    Android对手尽皆铩羽,鸿蒙如何绝地求生? 作为华为绝地反击备胎计划中的重要组成部分,鸿蒙被国人寄予了厚望.但是,除了热情我们更应该理性关注,鸿蒙对决Android未来有几成胜算?还有哪些问题需要 ...

  10. Disconf入门指南(1)

    Disconf简介 参考: https://github.com/knightliao/disconf/wiki/TutorialSummary 在一个分布式环境中,同类型的服务往往会部署很多实例.这 ...