hdu2099

来源:互联网 发布:阿里云地址 编辑:程序博客网 时间:2024/05/26 22:59

Problem Description一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢?

Input输入数据有若干组,每组数据包含二个整数a,b (0<a<10000, 10<b<100),若遇到0 0则处理结束。 


Output对应每组数据,将满足条件的所有尾数在一行内输出,格式见样本输出。同组数据的输出,其每个尾数之间空一格,行末没有空格。----------Sample Input200 401992 950 0Sample Output00 40 8015

package Temp;


import java.util.Scanner;


public class p2099 {


public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int a = sc.nextInt();
int b = sc.nextInt();
if (a == 0 && b == 0) {
break;
}
String str = "";
for (int i = 0; i < 100; i++) {
if ((a * 100 + i) % b == 0) {
if (i < 10) {
str = str + 0 + i + " ";
// System.out.print(str + " ");
} else {
str = str + i + " ";
// System.out.print(str + " ");
}
}
}
// 注意空格
System.out.print(str.substring(0, str.length() - 1));
System.out.println();
}
}


}

0 0
原创粉丝点击