ural 1352. Mersenne Primes
1352. Mersenne Primes
Memory limit: 64 MB
Input
Output
Sample
| input | output |
|---|---|
13 |
3217 |
题意:梅森素数:m=2^p-1,如果m是素数,则m被称为梅森素数,题意要求求出第i个梅森素数所对应的p的值
思路;梅森素数现在一共有43个,我们将他们所有的所对应的p值进行枚举
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string> using namespace std; int kiss[]={,,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
,,,,,,,}; int main()
{
int T;
scanf("%d",&T);
while(T){
int n;
scanf("%d",&n);
printf("%d\n",kiss[n]);
T--;
}
return ;
}
ural 1352. Mersenne Primes的更多相关文章
- URAL1352. Mersenne Primes
梅森素数 打表 搜梅森素数的时候 看到一句话 欧拉在双目失明的情况下 用心算出了2的31次方-1是素数 他用心算的... #include <iostream> #include<c ...
- Project Euler 97 :Large non-Mersenne prime 非梅森大素数
Large non-Mersenne prime The first known prime found to exceed one million digits was discovered in ...
- Effective Java 第三版——45. 明智审慎地使用Stream
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- Effective Java 第三版——48. 谨慎使用流并行
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- Codeforces225E - Unsolvable
Portal Description 求所有对于方程\[z=\left \lfloor \frac{x}{2} \right \rfloor+y+xy\]不存在正整数解\((x,y)\)的\(z\)中 ...
- UVA 583 分解质因数
Webster defines prime as:prime (prim) n. [ME, fr. MF, fem. of prin first, L primus; akin to L prior] ...
- [Java读书笔记] Effective Java(Third Edition) 第 7 章 Lambda和Stream
在Java 8中,添加了函数式接口(functional interface),Lambda表达式和方法引用(method reference),使得创建函数对象(function object)变得 ...
- sicily 1009. Mersenne Composite N
Description One of the world-wide cooperative computing tasks is the "Grand Internet Mersenne P ...
- [LeetCode] Count Primes 质数的个数
Description: Count the number of prime numbers less than a non-negative number, n click to show more ...
随机推荐
- hdu 5207 BestCoder Round #38 ($) Greatest Greatest Common Divisor
#include<stdio.h> #include<string.h> #include<math.h> ]; ]; int main() { int sb; s ...
- 解决ie 低版本的 background-size 兼容问题
在IE不支持这个属性的时候可以通过滤镜来实现这样的一个效果. div{background-size: cover;filter:progid:DXImageTransform.Microsoft.A ...
- java 的对象拷贝(有深浅拷贝两种方式,深拷贝实现的两种方式(逐层实现cloneable接口,序列化的方式来实现))
Java提高篇--对象克隆(复制)(转自:http://www.cnblogs.com/Qian123/p/5710533.html#_label0) 阅读目录 为什么要克隆? 如何实现克隆 浅克 ...
- windows上安装ubuntukylin16.04并且在ubuntukylin上安装jdk
1.安装ubuntukylin16.04 教程链接:http://jingyan.baidu.com/article/f71d60379824041ab641d19d.html 我是完全按照这个教程来 ...
- 数数字(Digit Counting,ACM/ICPC Danang 2007,UVa1225)
#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char s[10000]; in ...
- oAuth 使得第三方无需使用用户的用户名与密码就可以申请获得该用户资源的授权
OAUTH协议为用户资源的授权提供了一个安全的.开放而又简易的标准.与以往的授权方式不同之处是OAUTH的授权不会使第三方触及到用户的帐号信息(如用户名与密码),即第三方无需使用用户的用户名与密码就可 ...
- javaWEB总结(11):JSP简介及原理
前言 本文主要通过一个简单小例子,介绍JSP的原理. 1.项目结构 2.web.xml <?xml version="1.0" encoding="UTF-8&qu ...
- Major and minor numbers
The major nuber is the driver associated with the device, while the minor number is used by the kern ...
- Dubbo.xml配置源-Dubbo.xsd分析
我们使用Dubbo时,一般都会使用xml配置基本信息,如项目名称(application).注册中心(register).协议(protocal).服务(service),如下所示: 1 2 3 ...
- Chapter 2 Open Book——23
Mike interrupted us then — he was planning an epic battle of the blizzard in the parking lot after s ...