andre_joy

导航

hdu 2521

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2521

题意:中文……

mark:数据较少,直接暴力破解,0ms。

代码:

#include <stdio.h>

int m[5010];

int main()
{
    int t,a,b,max;
    for(a = 2; a < 5001; a++)
        for(b = a; b < 5001; b += a)
            m[b]++;
    scanf("%d", &t);
    while(t-- && scanf("%d%d", &a, &b))
    {
        max = a;
        for(a++; a <= b; a++)
            if(m[a] > m[max]) max = a;
        printf("%d\n", max);
    }
    return 0;
}

posted on 2012-06-30 23:14  andre_joy  阅读(76)  评论(0编辑  收藏  举报