Reprinted please indicate the source: Thank you
Http://user.qzone.qq.com/289065406/blog/1309336489
General question:
An H-number is the number of all modulo elements.
If an H-number is H-Primes only when its factor is 1 and itself (except 1 ).
An H-number is H-semi-Prime when and only when it is represented by the product of two H-primes.
The remaining number of H-number is H-composite.
I will give you a number of H and ask how many H-semi-prime numbers are there from 1 to H.
Solution:
It doesn't feel like it's the same as the coemon...
Screen the table and output it directly... Questions...
// Memory time // 4172 K 63 MS # include <iostream> using namespace STD; const int size = 1000001; int h_number [size + 1]; /* screen the table */void table (void) {memset (h_number, 0, sizeof (h_number )); // h_number [I] = 0 indicates that I is H-primefor (INT I = 5; I <= size; I + = 4) {for (Int J = 5; j <= size; j + = 4) {int multiply = I * j; If (multiply> size) break; if (h_number [I] = 0 & h_number [J] = 0) // both I and J are H-primeH_Number [multiply] = 1; // multiply for H-semi-primeselseH_Number [multiply] =-1; // multiply for H-composite} int pcount = 0; // H-prime counter for (int K = 1; k <= size; k ++) {If (h_number [k] = 1) pcount ++; h_number [k] = pcount; // pcount H-semi-Primes} return ;}int main (void) {table (); int H from 1 to K; while (CIN> H & H) cout <H <''