Problem Description 一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢?
Input 输入数据有若干组,每组数据包含二个整数a,b( 0< a < 10000, 10 < b < 100),若遇到0 0则处理结束。
Output 对应每组数据,将满足条件的所有尾数在一行内输出,格式见样本输出。同组数据的输出,其每个尾数之间空一格,行末没有空格。
Sample Input 200 40 1992 95 0 0
Sample Output 00 40 80 15
注意:特别注意输出格式!!! 还有后面2位数小于10的输出!! 例:00 05 04
import java.util.Scanner;
public class Main{
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){
return ;
}
a=a*100;
int c=0;
for(int i=a/b-105;i<a/b+105;i++){
if(((b*i)-a>=0)&&((b*i)-a<100)){
if((b*i)%100<10){
if(c==0){
c=1;
System.out.print("0"+(b*i)%100);
}else{
System.out.println(" "+"0"+(b*i)%100);
}
}else{
if(c==0){
c=1;
System.out.print((b*i)%100);
}else{
System.out.print(" "+(b*i)%100);
}
}
}
}
System.out.println();
//System.out.println("aaa");
}
}
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有