Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

筛法打表0ms过

Posted by Eov_Second at 2016-12-01 00:22:09 on Problem 3978
先筛出10万以内素数,然后用数组F[i]表示自然数i之前(不包括i本身)的素数个数(一遍循环就能构造出来)。最后只要输出F[B] - F[A] + j(j取值为0或1,看B是否为素数)
当然要注意输入为复数的情况。筛的时候以及最后构造F[i]其实都可以去掉偶数,这样能节约一半的空间

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator