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 ...
随机推荐
- WPF DataGrid自动生成列
<Window x:Class="DataGridExam.MainWindow" xmlns="http://schemas.microsoft.c ...
- linux 下添加 路由
# yum install -y pptp pptp-setup 从 http://ip.line668.com/ip.php 看ip列表,找国外的ip. # pptpsetup --create ...
- 基于IOCP的高速文件传输代码
//服务端: const //transmit用的参数 TF_USE_KERNEL_APC = $20; //命令类型 CMD_CapScreen = ...
- 在WPF程序中将控件所呈现的内容保存成图像
原文:在WPF程序中将控件所呈现的内容保存成图像 有的时候,我们需要将控件所呈现的内容保存成图像保存下来,例如:InkCanvas的手写墨迹,WebBrowser中的网页等.可能有人会说,这个不就是截 ...
- Win8 Metro(C#)数字图像处理--2.38Hough变换直线检测
原文:Win8 Metro(C#)数字图像处理--2.38Hough变换直线检测 [函数名称] Hough 变换直线检测 HoughLineDetect(WriteableBit ...
- Qt 5.9对Mac的图形显示有许多改进
We have some platform specific improvements as well as support for new platforms and compilers comin ...
- shell产生随机数
#!/bin/bash # 每次调用$RANDOM都会返回不同的随机整数. # 一般范围为: - (有符号的16-bit整数). MAXCOUNT= count= echo echo "$M ...
- Windows下 Composer 安装 Thinkphp5 的记录.
首先安装Composer, 下载地址: https://www.phpcomposer.com/ Windows安装过程及其简单,请自行搜索解决. 接下来Win+R, 启动命令行窗口,以下所有操作都是 ...
- 毕设(五)ListView
ListView 控件可使用四种不同视图显示项目.通过此控件,可将项目组成带有或不带有列标头的列,并显示伴随的图标和文本. 可使用 ListView 控件将称作 ListItem 对象的列表条目组织成 ...
- Delphi 10.2 非官方补丁合集
Delphi 10.2 非官方补丁合集http://blog.qdac.cc/?p=4485 FMXObject和TFORM的释放都变成异步了.虽然能保证是在主线程中释放,但是Windows部分的线程 ...