import java.util.Scanner;
public class Main{
public static void main(String[] args) {
int num[] = new int[5001];
for (int i = 1; i < num.length; i++) {
for (int j = i; j < num.length; j++) {
if (j%i==0) {
num[j]++;
}
}
}
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
int a = sc.nextInt();
int b = sc.nextInt();
int max = num[a];
int ans = a;
for (int i = a+1; i <= b; i++) {
if (num[i]>max) {
max = num[i];
ans = i;
}
}
System.out.println(ans);
}
sc.close();
}
}
HDOJ 2521 反素数
最新推荐文章于 2019-04-02 11:24:53 发布