解题思路:import java.math.BigInteger;
import java.util.Scanner;
public class C1074 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final BigInteger SEVENTEEN = BigInteger.valueOf(17);
while (sc.hasNext()) {
String str = sc.nextLine();
if("0".equals(str))
break;
BigInteger a = new BigInteger(str.substring(0, str.length()-1));
int b = 5 * Integer.valueOf(str.substring(str.length()-1));
BigInteger rs = a.subtract(BigInteger.valueOf(b)).mod(SEVENTEEN);
System.out.println(rs.intValue() == 0 ? 1 : 0);
}
sc.close();
}
}
注意事项:
参考代码: