NO5——素数筛选
#include <stdio.h> int main()
{
int i,j,a[]={};
for(i=;i<=;i++)
a[i]=;
for(i=;i<=;i++)
if(a[i])
for(j=i+i;j<=;j+=i)
a[j]=;
for(i=;i<=;i++)
if(a[i])
printf("%d ",i);
printf("\n");
return ;
}
NO5——素数筛选的更多相关文章
- 1341 - Aladdin and the Flying Carpet ---light oj (唯一分解定理+素数筛选)
http://lightoj.com/volume_showproblem.php?problem=1341 题目大意: 给你矩形的面积(矩形的边长都是正整数),让你求最小的边大于等于b的矩形的个数. ...
- codeforces Soldier and Number Game(dp+素数筛选)
D. Soldier and Number Game time limit per test3 seconds memory limit per test256 megabytes inputstan ...
- POJ 3978 Primes(素数筛选法)
题目 简单的计算A,B之间有多少个素数 只是测试数据有是负的 //AC //A和B之间有多少个素数 //数据可能有负的!!! #include<string.h> #include< ...
- POJ 2689 Prime Distance (素数筛选法,大区间筛选)
题意:给出一个区间[L,U],找出区间里相邻的距离最近的两个素数和距离最远的两个素数. 用素数筛选法.所有小于U的数,如果是合数,必定是某个因子(2到sqrt(U)间的素数)的倍数.由于sqrt(U) ...
- algorithm@ Sieve of Eratosthenes (素数筛选算法) & Related Problem (Return two prime numbers )
Sieve of Eratosthenes (素数筛选算法) Given a number n, print all primes smaller than or equal to n. It is ...
- LightOJ 1236 Pairs Forming LCM (LCM 唯一分解定理 + 素数筛选)
http://lightoj.com/volume_showproblem.php?problem=1236 Pairs Forming LCM Time Limit:2000MS Memor ...
- LightOJ 1259 Goldbach`s Conjecture (哥德巴赫猜想 + 素数筛选法)
http://lightoj.com/volume_showproblem.php?problem=1259 题目大意:给你一个数n,这个数能分成两个素数a.b,n = a + b且a<=b,问 ...
- LightOJ 1341 - Aladdin and the Flying Carpet (唯一分解定理 + 素数筛选)
http://lightoj.com/volume_showproblem.php?problem=1341 Aladdin and the Flying Carpet Time Limit:3000 ...
- poj 2262 Goldbach's Conjecture(素数筛选法)
http://poj.org/problem?id=2262 Goldbach's Conjecture Time Limit: 1000MS Memory Limit: 65536K Total ...
随机推荐
- [HP-UNIX]bdf命令总结
(1)bdf命令的效果 lijiaman$[/home/oracle]bdf Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 ...
- B. Train Seats Reservation 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
You are given a list of train stations, say from the station 1 to the station 100. The passengers ca ...
- Laravel 集合的处理
其中的方法有: $arrs = collect($arr)->collapse()->collapse() //去除最外一层数组,不论最外层数组时否有值,都会去除掉 collect($ar ...
- oracle 11g grid软件安装[20180121]
实验环境: 系统->Redhat 6.5 Oracle软件版本->oracle 11.2.0.4.0 系统初始化 设定hosts主机名和对应IP地 ...
- python 如何在列表list,字典dict,集合set 中根据条件筛选数据
from random import randint """ list 过滤掉负数 """ data = [randint(-10, 10) ...
- jQuery 切换图片(图标)效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- python实现归并排序,归并排序的详细分析
python实现归并排序,归并排序的详细分析. 学习归并排序的过程是十分痛苦的.它并不常用,看起来时间复杂度好像是几种排序中最低的,比快排的时间复杂度还要低,但是它的执行速度不是最快的.很多朋友不 ...
- java简单web爬虫(网页图片)
java简单web爬虫(网页图片)效果,执行main()方法后图片就下载道C盘的res文件夹中.没有的话创建一个文件夹代码里的常量根据自己的需求修改,代码附到下面. package com.sinit ...
- Mysql 5.7 开启远程连接
1 在控制台执行 mysql -uroot -p 系统提示输入数据库root用户的密码,输入完成后即进入mysql控制台 2 选择数据库 mysql -uroot -p use mysql; 开启远程 ...
- kylin实战系列(一)
kylin实战系列(一) 把之前kylin的实践小结一下,以备以后查看.