import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
while (n-->0) {
int start = sc.nextInt();
int end = sc.nextInt();
int a = start;
int b = end;
int result = 0;
int max = g(start);
for (; start <= end; start++) {
if (max <= g(start)) {
max = g(start);
}
}
for (; a <= b; a++) {
if (g(a) == max) {
result = a;
break;
}
}
System.out.println(result);
}
}
public static int g(int number) {
int count = 0;
for (int i = 1; i <= number; i++) {
if (number % i == 0) {
count++;
}
}
return count;
}
}
杭电2521 反素数
最新推荐文章于 2021-07-17 15:54:22 发布