编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#2845 #1002. 找倍数 Compile Error 0 0 ms 0 K Java / 377 B Ann 2023-11-21 22:16:16
显示原始代码
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String N = scan.nextLong();
        long x = 0;
        while (x < 998244353) {
            if ((N - x) % 998244353 == 0)
                if (N - x <= -998244353 || N - x >= 998244353)
                    break;
            x++;
        }
        if (x == 998244353)
            System.out.println(-1);
        System.out.println(x);
    }
}

编译信息

Main.java:5: error: incompatible types: long cannot be converted to String
		String N = scan.nextLong();
		                        ^
Main.java:8: error: bad operand types for binary operator '-'
			if((N-x)%998244353==0)
			     ^
  first type:  String
  second type: long
Main.java:9: error: bad operand types for binary operator '-'
				if(N-x<=-998244353||N-x>=998244353)
				    ^
  first type:  String
  second type: long
Main.java:9: error: bad operand types for binary operator '-'
				if(N-x<=-998244353||N-x>=998244353)
				                     ^
  first type:  String
  second type: long
4 errors