参考代码:
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
final BigInteger m17=BigInteger.valueOf(17);
while(true)
{
String str=sc.nextLine();
if(str.equals("0")) //不能用if(str=="0")!!!!!!
break;
String firstStr=str.substring(0,str.length()-1); //将字符串转换为大数
String endStr=str.substring(str.length()-1);
BigInteger a=new BigInteger(firstStr);
int b= 5*Integer.parseInt(endStr);
BigInteger b5=BigInteger.valueOf(b);
BigInteger ab=a.subtract(b5); //在对大数进行处理
BigInteger eq=ab.mod(m17);
System.out.println(eq==BigInteger.ZERO?1:0);
}
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.6 (C++代码)浏览:891 |
数组输出 (C语言代码)错误???浏览:563 |
C二级辅导-阶乘数列 (C语言代码)浏览:690 |
淘淘的名单 (C语言代码)浏览:1100 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:669 |
最小公倍数 (C语言代码)浏览:1028 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:537 |
星期判断机 (C语言代码)浏览:859 |
Tom数 (C语言代码)浏览:492 |
C二级辅导-求偶数和 (C语言代码)浏览:672 |