服了,搞半天,原来是我long存的数据太小,不得不用BigIntger了。 Scanner sc = new Scanner(System.in); while (sc.hasNext()) { // long a = sc.nextLong(); // long b = sc.nextLong(); // long c = sc.nextLong(); BigInteger a = new BigInteger(sc.next()); BigIn...