HDOJ 2099 整除的尾数

举报
谙忆 发表于 2021/05/28 08:25:46 2021/05/28
【摘要】 Problem Description 一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢? Input 输入数据有若干组,每组数据包含二个整数a,b( 0< a < 10000, 10 < b < 100),若遇到0 0则处理结束。 Output 对应每组数据,将满足条件的所有尾数在一行内输出,格式见...

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"); } }

}

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44

文章来源: chenhx.blog.csdn.net,作者:谙忆,版权归原作者所有,如需转载,请联系作者。

原文链接:chenhx.blog.csdn.net/article/details/50603373

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。