直接用肯定时间比较长,最大的数估计五秒出来。
#include<stdio.h>
#include<math.h>
int main()
{
int n , m ;
while(EOF!=(scanf("%d%d",&n,&m))&&!(n==0||m==0))
{
int temp;
double rezult = 0.0;
if(n>m)
{
temp = n ;
n = m ;
m = temp ;
}
if(n%2==0){
n++ ;
}
for(int i = n ; i <= m ; i += 2)
{
rezult += log10(i);
}
printf("%ld\n",long(rezult/log10(2))+1);
}
return 0 ;
}
#include<stdio.h>
#include<math.h>
int main()
{
int n , m ;
while(EOF!=(scanf("%d%d",&n,&m))&&!(n==0||m==0))
{
int temp;
double rezult = 0.0;
if(n>m)
{
temp = n ;
n = m ;
m = temp ;
}
if(n%2==0){
n++ ;
}
for(int i = n ; i <= m ; i += 2)
{
rezult += log10(i);
}
printf("%ld\n",long(rezult/log10(2))+1);
}
return 0 ;
}
倚天照海花无数,流水高山心自知。