| ||||||||||
| 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 | |||||||||
Re:SB题目……详见代码In Reply To:SB题目……详见代码 Posted by:buaabarty at 2011-07-21 15:32:26 #include <stdio.h>
int p[50001]={0};
void sieve(){
int i,j,k;
for(i=1;i<159;++i)
if(!p[i])
for(k=(i<<1)+1,j=i*k+i;j<50000;j+=k)
p[j]=1;
for(p[0]=i=1;i<50001;++i)p[i]=p[i-1]+1-p[i];}
int main(){
int a,b;
sieve();
while(scanf("%d%d",&a,&b),a!=-1||b!=-1)
printf("%d\n",(b<2?0:p[(b-1)>>1])-(a<3?0:p[(a>>1)-1]));
return 0;}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator