Ural 1086 - Cryptography
Input
Output
Sample
input | output |
---|---|
4 |
5 |
Hint
算法:
// Ural Problem 1086. Cryptography
// Judgement result: Accepted
// Submission Date: 10:51 16 Jan 2014
// Run Time: 0.812s
// Memory used: 273KB
// Language: GCC 4.7.2 C11
//
// 版权所有(C)acutus (mail: acutus@126.com)
// 博客地址:http://www.cnblogs.com/acutus/// [解题方法]
// 简单素数题,直接打表判断 #include<stdio.h> int a[];
void init()
{
int i, count, flag, j;
flag = ;
count = ;
a[] = ;
a[] = ;
j = ;
while() {
for(i = ; i <= count; i++){
if(j % a[i] == ) {
flag = ;
break;
}
}
if(flag){
count++;
a[count] = j;
}
flag = ;
j += ;
if(count > ) break;
}
} void solve()
{
int n, N;
init();
scanf("%d", &N);
while(N--) {
scanf("%d", &n);
printf("%d\n", a[n]);
}
} int main()
{
solve();
return ;
}
Ural 1086 - Cryptography的更多相关文章
- URAL题解二
URAL题解二 URAL 1082 题目描述:输出程序的输入数据,使得程序输出"Beutiful Vasilisa" solution 一开始只看程序的核心部分,发现是求快排的比较 ...
- 【线性筛】【筛法求素数】【素数判定】URAL - 2102 - Michael and Cryptography
暴力搞肯定不行,因此我们从小到大枚举素数,用n去试除,每次除尽,如果已经超过20,肯定是no.如果当前枚举到的素数的(20-已经找到的质因子个数)次方>剩下的n,肯定也是no.再加一个关键的优化 ...
- .Net使用system.Security.Cryptography.RNGCryptoServiceProvider类与System.Random类生成随机数
.Net中我们通常使用Random类生成随机数,在一些场景下,我却发现Random生成的随机数并不可靠,在下面的例子中我们通过循环随机生成10个随机数: ; i < ; i++) { Rando ...
- ECC-Elliptic Curves Cryptography,椭圆曲线密码编码学
ECC ECC-Elliptic Curves Cryptography,椭圆曲线密码编码学,是目前已知的公钥体制中,对每比特所提供加密强度最高的一种体制.在软件注册保护方面起到很大的作用,一般的序列 ...
- "System.Security.Cryptography.CryptographicException: 拒绝访问" 问题的解决方法
.net web程序使用rsa算法进行加解密时,程序报告“System.Security.Cryptography.CryptographicException: 拒绝访问”错.按网上搜的解决方法做了 ...
- BZOJ 1086: [SCOI2005]王室联邦
1086: [SCOI2005]王室联邦 Time Limit: 10 Sec Memory Limit: 162 MBSec Special JudgeSubmit: 1399 Solved: ...
- HDOJ(2056)&HDOJ(1086)
Rectangles HDOJ(2056) http://acm.hdu.edu.cn/showproblem.php?pid=2056 题目描述:给2条线段,分别构成2个矩形,求2个矩形相交面 ...
- System.Security.Cryptography.CryptographicException: 指定了无效的提供程序类型
这两天在调用银联在线的支付接口,把银联提供的demo代码copy过来放到自己网站上,生成通过了,但是运行的时候就报错了: 指定了无效的提供程序类型. 说明: 执行当前 Web 请求期间,出现未经处理的 ...
- [POJ2109]Power of Cryptography
[POJ2109]Power of Cryptography 试题描述 Current work in cryptography involves (among other things) large ...
随机推荐
- perl5 第六章 模式匹配
第六章 模式匹配 by flamephoenix 一.简介二.匹配操作符三.模式中的特殊字符 1.字符+ 2.字符 []和[^] 3.字符 *和? 4.转义字符 5.匹配任意字母或数字 6 ...
- VC获取精确时间的做法
声明:本文章是我整合网上的资料而成的,其中的大部分文字不是我所为的,我所起的作用只是归纳整理并添加我的一些看法.非常感谢引用到的文字的作者的辛勤劳动,所参考的文献在文章最后我已一一列出. 对关注性能的 ...
- Poj 2371 Questions and answers(排序)
题目链接:http://poj.org/problem?id=2371 思路分析:使用计数排序或其他时间复杂度为O( log N )的排序. 代码如下: #include <iostream&g ...
- beini破解无线
软件介绍 当你的笔记本有无线网卡却不能上网的时刻,也许你会很焦急. 又或许你的隔壁就有无线网络可以接的时刻,但你却由于米有密码而不能上网.下面我将简介一款可以令你惊讶的软件,奶瓶 有了奶瓶以上疑问都可 ...
- TCP传输连接建立与释放详解
一直以来有许多读者朋友对TCP的传输连接建立和释放过程不是很理解,而这又是几乎网络认证中必考的知识点,包括软考.CCNA\CCNP.H3CNA\H3CNE等,为此再把笔者年度巨作,广受好评的——< ...
- C++ Primer的课后规划问题的第八章
1.写通常需要一个参数(字符串的地址).字符串和打印功能. 只要.假设提供了第二个参数(int种类),而这个参数不0,的次数的函数打印串数量为该功能将被称为(意,字符串的打印次数不等于第二个參数的值. ...
- 光学基础知识:白光、颜色混合、RGB、色彩空间
1665年,牛顿(Isaac Newton)进行了太阳光实验,让太阳光通过窗板的小圆孔照射在玻璃三角棱镜上,光束在棱镜中折射后,扩散为一个连续的彩虹颜色带,牛顿称之为光谱,表示连续的可见光谱.而可见光 ...
- 指尖上的电商---(2)Solr全文搜索引擎的准备工作
Solr是一个基于Lucene的全文搜索引擎.提供了更丰富的搜索语言.更灵活的配置.更高的查询效率. 一句话.与Lucene相比.有过之而无不及.这一节里, 主要谈论两个知识点:Jdk的安装和Tomc ...
- MVC3 验证码
public ActionResult GetValidateCode() { string code = CreateValidateC ...
- Xcode - 内存分析
内存分析工具 1. ARC中的内存泄露 1. 一般内存分析, 主要是看看有没有内存泄露 2. 内存泄露: 创建了对象, 使用完毕没有释放, 将来就可能造成内存泄露 3. 内存泄露: 主要用于MRC的内 ...