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#泛型类的用途和说明

    class Program    {        public class Test<T, S>        {           //泛型类的类型参数可用于类成员          ...

  2. website robots.txt 防爬虫 措施

    robots.txt文件用法举例: 1. 允许所有的robot访问 User-agent: * Allow: / 或者 User-agent: * Disallow: 2. 禁止所有搜索引擎访问网站的 ...

  3. 将我们的parser转换成Monad

    还记得我们上一篇delegate类型的parser吗 ,在开始本篇之前,强烈建议你复习一下这个parser定义  public delegate Maybe<Tuple<T,string& ...

  4. 仿QQ浏览器mac版官网主页 html+css3特效

    这是一款超酷的CSS3动态背景动画特效,CSS3仿QQ浏览器官网彗星动画背景特效. 在线演示本地下载

  5. Activity创建时布局文件的实现原理

    setContenView(R.id.activity)实现原理 1.底层框架根据布局ID找到布局文件. 2.底层框架解析此布局文件(pull解析). 3.底层框架通过反射构建布局文件中的元素对象(E ...

  6. MySQL 5.6 Reference Manual-14.2 InnoDB Concepts and Architecture

    14.2 InnoDB Concepts and Architecture 14.2.1 MySQL and the ACID Model 14.2.2 InnoDB Multi-Versioning ...

  7. 【Oracle】RAC集群中的命令

    数据库名称:racdb 节点名称:rac3.rac4 注:以下命令均在grid用户中执行 1.查看集群节点的状态: [grid@rac3 ~]$ crsctl check cluster [grid@ ...

  8. vue 返回上一页在原来的位置

    http://www.jb51.net/article/118592.htm http://blog.csdn.net/qq_26598303/article/details/51189235 htt ...

  9. 根据业务自己设计的.NET工厂模式架构

    最近项目的架构需要做调整优化,根据业务需要写了一个简单的工厂模式架构 项目介绍:整个系统分为三大平台(这里用A,B,C来标示),每个平台又细分为多个APP客户端(每个APP都有appid来区分) 因为 ...

  10. 优动漫PAINT之绘画助手软件简介

    在下载安装优动漫PAINT的时候,它会附带一个叫做绘画助手的一个小软件.绘画助手是一款用于PC端的创作辅助工具软件,针对画师们在绘画时可能遇到的各种问 题和需求,提供了作品保护.云配置.软件管理.色板 ...