poj3292-Semi-prime H-numbers(筛法打表)】的更多相关文章

题目链接:https://vjudge.net/problem/POJ-3292 题意:定义4n+1数(简称H数),H数分为三类:unit,即为1; H-primes,只能分解为1×自身,类似于我们平时说的素数; H-composites,除unit和H-primes数以外的H数.输入h,求[1,h]之间的H-composites数的个数. 思路:写了我3个多小时,因为题目理解错误和代码错误,写得崩溃..QAQ.先说我想到的正确解法,注意到H-primes和我们说的素数基本类似,所以我们可以用欧…
第一眼看这道题目的时候觉得可能会很难也看不太懂,但是看了给出的Hint之后思路就十分清晰了 Consider the first sample. Overall, the first sample has 3 queries. The first query l = 2, r = 11 comes. You need to count f(2) + f(3) + f(5) + f(7) + f(11) = 2 + 1 + 4 + 2 + 0 = 9. The second query comes…
Almost prime numbers are the non-prime numbers which are divisible by only a single prime number.In this problem your job is to write a program which finds out the number of almost prime numberswithin a certain range.InputFirst line of the input file c…
OJ题目:click here~~ 题目分析:输出第k个素数 贴这么简单的题目,目的不清纯 用筛法求素数的基本思想是:把从1開始的.某一范围内的正整数从小到大顺序排列, 1不是素数,首先把它筛掉.剩下的数中选择最小的数是素数,然后去掉它的倍数. 依次类推.直到筛子为空时结束. 如有: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1不是素数.去掉.剩下的数中2最小,是素数,去掉2的…
C. Hexadecimal's Numbers time limit per test 1 second memory limit per test 64 megabytes input standard input output standard output One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the me…
一,题意:  一个H-number是所有的模四余一的数.(x=4*k+1)  如果一个H-number是H-primes 当且仅当它的因数只有1和它本身(除1外). 一个H-number是H-semi-prime当且仅当它只由两个H-primes的乘积表示. H-number剩下其他的数均为H-composite. 给你一个数h,问1到h有多少个H-semi-prime数.二,思路: 1,打表; 2,记数,并储存; 3,输出;三,步骤:  1,打H-semi-prime表 i,初始化H_numb…
传送门:点我 N-digit numbers Find the quantity of N-digit numbers, which the sum is equal to their product. Call the least from numbers for given N (N < 10). Input The number N is not exceeding 10. Output In output file have written 2 numbers: a quantity o…
zk has n numbers a1,a2,...,ana1,a2,...,an. For each (i,j) satisfying 1≤i<j≤n, zk generates a new number (ai+aj)(ai+aj). These new numbers could make up a new sequence b1,b2,...,bn(n−1)/2b1,b2,...,bn(n−1)/2.  LsF wants to make some trouble. While zk i…
题意 给定 $d,x$,$f(d,k)$ 表示 $1 \sim k$ 中 $d$ 出现的次数, $k$ 满足 $f(d,k) = k$,求小于 $x$ 的最大的 $k$. 分析 正解不会...,学习了oeis大法. 打表得到前几个数字,然后取oeis上找完整的. 之所以能这么做,是因为 $k$ 只有有限个.其中最大是 $d=8$,也只有344个 (oeis A130430). #include <bits/stdc++.h> using namespace std; typedef long…
Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc. Specially, LPF(1) = 0. Inpu…