F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_39656812_16420\Main.java:1: 错误: 类PrimeExpressionChecker是公共的, 应在名为 PrimeExpressionChecker.java 的文件中声明
public class PrimeExpressionChecker {    public static boolean isPrime(int num) {        if (num < 2) {            return false;        }        for (int i = 2; i * i <= num; i++) {            if (num % i == 0) {                return false;            }        }        return true;    }    public static void checkExpression(int x, int y) {        boolean allPrime = true;        for (int n = x; n <= y; n++) {            int expressionValue = n * n + n + 41;            if (!isPrime(expressionValue)) {                allPrime = false;                break;            }        }        if (allPrime) {            System.out.println("OK");        } else {            System.out.println("Sorry");        }    }    public static void main(String[] args) {        Scanner scanner = new Scanner(System.in);        while (true) {            int x = scanner.nextInt();            int y = scanner.nextInt();            if (x == 0 && y == 0) {                break;            }            checkExpression(x, y);        }    }}
       ^
0_0_39656812_16420\Main.java:1: 错误: 找不到符号
public class PrimeExpressionChecker {    public static boolean isPrime(int num) {        if (num < 2) {            return false;        }        for (int i = 2; i * i <= num; i++) {            if (num % i == 0) {                return false;            }        }        return true;    }    public static void checkExpression(int x, int y) {        boolean allPrime = true;        for (int n = x; n <= y; n++) {            int expressionValue = n * n + n + 41;            if (!isPrime(expressionValue)) {                allPrime = false;                break;            }        }        if (allPrime) {            System.out.println("OK");        } else {            System.out.println("Sorry");        }    }    public static void main(String[] args) {        Scanner scanner = new Scanner(System.in);        while (true) {            int x = scanner.nextInt();            int y = scanner.nextInt();            if (x == 0 && y == 0) {                break;            }            checkExpression(x, y);        }    }}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^
  符号:   类 Scanner
  位置: 类 PrimeExpressionChecker
0_0_39656812_16420\Main.java:1: 错误: 找不到符号
public class PrimeExpressionChecker {    public static boolean isPrime(int num) {        if (num < 2) {            return false;        }        for (int i = 2; i * i <= num; i++) {            if (num % i == 0) {                return false;            }        }        return true;    }    public static void checkExpression(int x, int y) {        boolean allPrime = true;        for (int n = x; n <= y; n++) {            int expressionValue = n * n + n + 41;            if (!isPrime(expressionValue)) {                allPrime = false;                break;            }        }        if (allPrime) {            System.out.println("OK");        } else {            System.out.println("Sorry");        }    }    public static void main(String[] args) {        Scanner scanner = new Scanner(System.in);        while (true) {            int x = scanner.nextInt();            int y = scanner.nextInt();            if (x == 0 && y == 0) {                break;            }            checkExpression(x, y);        }    }}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
  符号:   类 Scanner
  位置: 类 PrimeExpressionChecker
3 个错误


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 06:44:30, Gzip enabled