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_39656810_7677.cpp:1:1: error: expected unqualified-id before 'public'
    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);        }    }}
      | ^~~~~~


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-26 19:04:53, Gzip enabled