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. mysql的递归(使用函数)

    getChildList: BEGIN #声明两个局部变量 ); ); #初始化局部变量 SET sTemp = ''; #调用cast函数将int转换为char SET sTempChd = roo ...

  2. RAP、Mock.js、Vue.js、Webpack

    最近做项目使用的是RAP1的接口,但是昨天开始,RAP1 出现了问题,接口都不能用了. 所以补充一下Mock.js的用法,以便在这种突发的情况时候时自己通过Mock的方式来处理接口. npm init ...

  3. Amaze UI的一点总结

    做一个微信公众号内的网页的时候,用到了Amaze UI,也称妹子UI. 官网上宣称,Amaze UI中国首个开源 HTML5 跨屏前端框架,用下来的感觉是比较类似于bootstrap,都是移动端优先. ...

  4. Nuget包含css\js等资源文件

    <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netst ...

  5. Everything Be True FreeCodeCamp

    function every(collection, pre) { // Is everyone being true? for(var i in collection){ if(!collectio ...

  6. JS 作业

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. js中时间戳与日期时间之间的相互转换

    1.时间戳转换为标准日期时间格式: function timeFormat(dateStr) { var date = new Date(dateStr); Y = date.getFullYear( ...

  8. int rc = -EINVAL是什么意思

    rc应该是return code的意思,将函数返回值rc初始化为-EINVAL,EINVAL由POSIX.1规范中的一个宏,一般通过包含C标准头文件errno.h,表示参数无效(invalid arg ...

  9. [长期更新]模板&算法学习情况

    这里仅作为自我检查用,模板代码请移步其他博文 标+的表示已学完,标?的表示需要进一步学习,标-的表示有计划但未开始学习,标*的表示暂时没有计划学习 数学 ?BSGS +FFT&NTT ?Luc ...

  10. Python爬虫基础--爬取车模照片

    import urllib from urllib import request, parse from lxml import etree class CarModel: def __init__( ...