| 数字整除 |
| Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB |
| Total submit users: 88, Accepted users: 82 |
| Problem 10932 : No special judgement |
| Problem description |
| 定理:把一个至少两位的正整数的个位数字去掉,再从余下的数中减去个位数的5倍。当且仅当差是17的倍数时,原数也是17的倍数 。
例如,34是17的倍数,因为3-20=-17是17的倍数;201不是17的倍数,因为20-5=15不是17的倍数。输入一个正整数n,你的任务是判断它是否是17的倍数。 |
| Input |
| 输入文件最多包含10组测试数据,每个数据占一行,仅包含一个正整数n(1<=n<=10100),表示待判断的正整数。n=0表示输入结束,你的程序不应当处理这一行。 |
| Output |
| 对于每组测试数据,输出一行,表示相应的n是否是17的倍数。1表示是,0表示否。 |
| Sample Input |
34201209876541317171717171717171717171717171717171717171717171717180 |
| Sample Output |
1010 |
| Problem Source |
| The Sixth Hunan Collegiate Programming Contest |
|
Submit Discuss Judge Status Problems Ranklist
JAVA一水题 纪念 import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
BigInteger s=BigInteger.ZERO;
Scanner cin= new Scanner(System.in);
BigInteger n;
while(cin.hasNext())
{
n=cin.nextBigInteger();
if(n.equals(s)) break;
BigInteger a = new BigInteger("17");
if( n.mod(a).equals(s))
System.out.println("1");
else
System.out.println("0");
}
}
}
|
HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online 数字整除 java,布布扣,bubuko.com
HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online 数字整除 java
原文:http://blog.csdn.net/fanerxiaoqinnian/article/details/37727757