Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
筛法打表0ms过先筛出10万以内素数,然后用数组F[i]表示自然数i之前(不包括i本身)的素数个数(一遍循环就能构造出来)。最后只要输出F[B] - F[A] + j(j取值为0或1,看B是否为素数) 当然要注意输入为复数的情况。筛的时候以及最后构造F[i]其实都可以去掉偶数,这样能节约一半的空间 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator