import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
String strs = scanner.nextLine();
String[] strings = strs.split(" ");
int x = Integer.parseInt(strings[0]);
int y = Integer.parseInt(strings[1]);
boolean bool = true;
if (y == 0 && x == 0) {
} else {
int[] num = new int[y - x + 1];
int j = 0;
for (int i = x; i <= y; i++) {
num[j] = (int) (Math.pow(i, 2) + i + 41);
j++;
}
for (int i = 0; i < num.length; i++) {
int n = 2;
while (num[i] % n == 0 && n < num[i]) {
bool = false;
n++;
}
}
if (bool) {
System.out.println("OK");
} else {
System.out.println("Sorry");
}
}
}
}
}
HDU—OJ 、2012(提交失败,但是自己运行完全符合要求,求解!!)
猜你喜欢
转载自blog.csdn.net/qq_39745932/article/details/82688162
今日推荐
周排行