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. C - Unary(map)

    Problem description Unary is a minimalistic Brainfuck dialect in which programs are written using on ...

  2. SEO规范(部分)

    1:尽量减少AJAX的使用搜索引擎无法检索ajax中的内容,也无法识别javascript代码. 2:拒绝iframe,frame标签iframe,frame会极大的阻碍搜索引擎爬取网站内容. 3:图 ...

  3. css简单介绍

    css层叠样式表,主要作用就是解决内容与表现分离的问题.html标签有自己的意义当然也是有自己的默认样式的,但有时候我们想修改他的样式,这时候就需要了css. 例:给字体加上颜色,我们有如下几种方法: ...

  4. Android 从imageview中获得bitmap的方法

    第一种: 使用setDrawingCacheEnabled()和getDrawingCache()这两种方法,第一个是为了设置是否开启缓存,第二个就可以直接获得imageview中的缓存,一般来说需要 ...

  5. hdu2883 最大流,判断满流 优化的SAP算法

    这是09年的多校联赛题目,比10年的难度要大.如果没做过hdu3572,建议先去做.有了解题思维再来做这题. 这题与hdu3572类似.但是1 <= si < ei <= 1,000 ...

  6. OpenCV、OpenCL、OpenGL、OpenPCL

    对于几个开源库的总结,作为标记,以前看过,现在开始重视起来!更详细资料请移步 开源中国社区! 涉及:OpenCV,OpenCL,OpenGL,OpenPCL 截止到目前: OpenGL的最新版本为4. ...

  7. tomcat_logs

    tomcat logs 目录下各日志文件的含义 参考地址: http://www.cnblogs.com/signheart/p/0ed0bef7dfadf59534eec76ad4607654.ht ...

  8. gulp打包压缩代码以及图片

    1.首先全局安装gulp 全局安装就不做介绍了 初学gulp,终于把常用的配置,api,语法弄明白了! gulp插件地址:http://gulpjs.com/plugins gulp官方网址:http ...

  9. 为my_string类创建复制构造函数copy constructor ,拷贝函数名和类同名

    为下面的my_string类创建一个复制构造函数,并将定义该类的代码提交. my_string类的定义: class my_string { char *s; public: my_string(ch ...

  10. Smallest Common Multiple FreeCodeCamp

    题目:找出能被两个给定参数和它们之间的连续数字整除的最小公倍数.  范围是两个数字构成的数组,两个数字不一定按数字顺序排序. 分析:首先题目的意思求一个连续数列的所有数字的最小公倍数,这连续的数字序列 ...