Codeforces 755A:PolandBall and Hypothesis(暴力)
http://codeforces.com/problemset/problem/755/A
题意:给出一个n,让你找一个m使得n*m+1不是素数。
思路:暴力枚举m判断即可。
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
#define N 100010
#define INF 0x3f3f3f3f int main()
{
int n;
cin >> n;
for(int i = ; i <= ; i++) {
int num = i * n + ;
int tmp = sqrt(num);
bool flag = ;
for(int i = ; i <= tmp; i++) {
if(num % i == ) {
flag = ; break;
}
}
if(flag) {
printf("%d\n", i);
break;
}
}
return ;
}
Codeforces 755A:PolandBall and Hypothesis(暴力)的更多相关文章
- 【codeforces 755A】PolandBall and Hypothesis
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Codeforces Gym 100015H Hidden Code 暴力
Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hac ...
- Codeforces gym 100685 A. Ariel 暴力
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...
- Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...
- [ An Ac a Day ^_^ ] CodeForces 691F Couple Cover 花式暴力
Couple Cover Time Limit: 3000MS Memory Limit: 524288KB 64bit IO Format: %I64d & %I64u Descri ...
- Codeforces 626D Jerry's Protest(暴力枚举+概率)
D. Jerry's Protest time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
- codeforces 650D D. Image Preview (暴力+二分+dp)
题目链接: http://codeforces.com/contest/651/problem/D D. Image Preview time limit per test 1 second memo ...
- Codeforces Gym 100203G Good elements 暴力乱搞
原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf 题解 考虑暴力的复杂度是O(n^3),所以 ...
- Codeforces 839D Winter is here - 暴力 - 容斥原理
Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n s ...
随机推荐
- 升级PHPstudy自带的mysql版本 从5.5升级到5.7.22
原文:升级PHPstudy自带的mysql版本 从5.5升级到5.7.22 版权声明:请注意:如需转载请注明出处. https://blog.csdn.net/qq_32534555/article/ ...
- springboot 集成swagger ui
springboot 配置swagger ui 1. 添加依赖 <!-- swagger ui --> <dependency> <groupId>io.sprin ...
- [转帖 ]MySQL 5.7 新特性 JSON
MySQL 5.7 新特性 JSON 的创建,插入,查询,更新 作者: 我不是鱼 (2016-08-31 16:13)分类: MySQL 标签: MySQL JSON MySQL JSON 应用 ...
- 关于JSP
JSP的本质 JSP本质上就是Servlet, 正常情况下, 它会在第一次被访问的时候被容器转化成Java代码, 然后再从Java代码编译成.class文件, 之后实际就和Servlet没区别了, 也 ...
- 重启网卡的几种方法(命令行,API,
1.重启windows网卡命令 rem 禁用网卡netsh interface set interface 本地连接 disabledrem 启用网卡 netsh interface set inte ...
- C++和QML混合的QT程序调试方法
以前调试只是QML或者只是C++的QT程序很简单,断点打上,直接debug按钮一点,喝一口水,自然就停在断点了. 这次遇到C++和QML混合的程序,把CONFIG+=declarative_debug ...
- Win8Metro(C#)数字图像处理--2.22二值图像膨胀
原文:Win8Metro(C#)数字图像处理--2.22二值图像膨胀 [函数名称] 二值图像膨胀函数DilationProcess(WriteableBitmap src) [算法说明] 膨胀 ...
- DBLINK学习
1.连接本地scott用户查看拥有的表 [oracle@ORADG ~]$ sqlplus scott/tiger SQL> select * from tab; TNAME ...
- node应用远程调试教程
远程调试 所谓远程调试,是指在本地IDE或命令行即时调试服务端代码,这在预发环境的测试阶段可以使用.远程调试避免了服务端环境的模拟,可快速定位bug. node应用调试 本文的教程主要针对采用 VS ...
- Bamboo 0.2.11 发布,HAProxy 自动配置
Bamboo 0.2.11 发布,此版本更新内容如下: 新特性 提供更多的模板字符串函数:strings.Split, strings.Join,strings.Replace, strings.T ...