求一道 hust acm解题报告:Prime's Sum Again.Prime's Sum AgainDescriptionAs is known to all,a prime number is a number which can only be divided by 1 and itself.For example:2,3 and 5 are all prime numbers but 4 and 6 are not,because 4 has anoth

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/07 21:30:13

求一道 hust acm解题报告:Prime's Sum Again.Prime's Sum AgainDescriptionAs is known to all,a prime number is a number which can only be divided by 1 and itself.For example:2,3 and 5 are all prime numbers but 4 and 6 are not,because 4 has anoth
求一道 hust acm解题报告:Prime's Sum Again.
Prime's Sum Again
Description
As is known to all,a prime number is a number which can only be divided by 1 and itself.For example:2,3 and 5 are all prime numbers but 4 and 6 are not,because 4 has another divisor 2,and 6 has two other divisors 2 and 3.
Then the problem is:give you two nonnegative integers L and R,you are asked to tell me the sum of all the prime numbers in the range [L,R).Range [L,R) means all the integers x that L

求一道 hust acm解题报告:Prime's Sum Again.Prime's Sum AgainDescriptionAs is known to all,a prime number is a number which can only be divided by 1 and itself.For example:2,3 and 5 are all prime numbers but 4 and 6 are not,because 4 has anoth
你可以考虑打表 打一部分 比如只记录隔上100000的质数(100000不行可以试试别的)
这样l 到r 就可以快速找到[100000a,100000b]中质数的和
然后暴力[l,100000a) (100000b,r] 的质数 再加上去