标签:des style color os io java strong ar for
3 2 3 1 10 47 359
2 6 240
#include<stdio.h>
int s[5010]={0,1,2,2};
void f()
{
int i,j;
for(i=4;i<5010;i++)
{
for(j=2;j<=i/2;j++)//i/2表示最大公约数
//for(j=2;j*j<=i;j++)
if(i%j==0) s[i]++;
s[i]+=2;
}
}
int main()
{
f();
int n,a,b,i,max,t;
scanf("%d",&n);
while(n--)
{
scanf("%d %d",&a,&b);
t=a;
max=0;
for(i=a;i<=b;i++)
{
if(s[i]>max)
{
max=s[i];
t=i;
}
}
printf("%d\n",t);
}
return 0;
}
标签:des style color os io java strong ar for
原文地址:http://www.cnblogs.com/mfrbuaa/p/3949784.html