CO-PRIME
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述
This problem is so easy! Can you solve it?
You are given a sequence which contains n integers a1,a2……an, your task is to find how many pa...
分类:
其他好文 时间:
2015-08-17 17:26:17
阅读次数:
164
Problem Description
Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pic...
分类:
编程语言 时间:
2015-08-17 17:19:11
阅读次数:
264
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4135题意:给一个区间[a,b],再给你一个数n,求在这个区间[a,b]中与n互质的数的个数。思路:这是一道数学题,如果数据范围不大的话可以直接套用欧拉函数,但是数据范围给得很大。所以用容斥原理来做。具体...
分类:
其他好文 时间:
2015-08-17 15:26:52
阅读次数:
102
In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each other via networks. If two QS want to get connected, they need to buy two
network adapter...
分类:
Web程序 时间:
2015-08-17 12:03:17
阅读次数:
183
http://poj.org/problem?id=2689/*区间筛法适用于L, R范围比较大,但是区间长度较小时套个模板然后取出最小最大就可以*//************************************************* Author :Powatr* C...
分类:
其他好文 时间:
2015-08-17 11:26:33
阅读次数:
169
hdu2824
欧拉函数模板
#include
using namespace std;
const int N=3000010;
int prime[N],isprime[N];
int phi[N];
void get_phi(){
int i,j,cnt=0;
for(i=2;i<N;i++)
{
if(isprime[i]==0){
...
分类:
其他好文 时间:
2015-08-17 01:12:52
阅读次数:
197
如果只是对一个整数进行素性测试的只要o(√n)的复杂度便可以判定,蓝而如果是n个呢(n n) break;11 check[prime[j] * i] = 1;12 if(i % prime[j] == 0)break;13 } 14 }这个貌似只是做了少许改...
分类:
其他好文 时间:
2015-08-16 22:54:24
阅读次数:
132
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 bool visit[10100000]; 7 int prime[10000000]; 8 9 10 void init_prim()11 {12 ...
分类:
其他好文 时间:
2015-08-16 18:02:17
阅读次数:
146
题目地址:POJ 3126
题意:给你两个4位的都是素数正整数n,m,每次可以变 个十百千位 中的一个数(变化后也是素数,问最少经过多少次变化n能变成m,如果不能输出Impossible(窝觉得并没有不成立的情况
思路:每次变化一位,然后搜就好了。#include
#include
#include
#include <stdlib.h...
分类:
其他好文 时间:
2015-08-16 16:42:44
阅读次数:
127
Problem DescriptionGive you a lot of positive integers, just to find out how many prime numbers there are.InputThere are a lot of cases. In each case,...
分类:
其他好文 时间:
2015-08-16 16:31:59
阅读次数:
101