码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 2099 整除的尾数

时间:2018-07-15 11:23:43      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:pac   time   mit   strong   memory   bit   ref   turn   problem   

传送门:

http://acm.hdu.edu.cn/showproblem.php?pid=2099

整除的尾数

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 48006    Accepted Submission(s): 20411


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
 

 

Source
分析:
注意格式问题
比如1要写成01
code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b;
    int c[100];
    while(~scanf("%d %d",&a,&b))
    {
        if(a==0&&b==0)
            break;
        a=a*100;
        int k=0;
        for(int i=0;i<=99;i++)
        {
            if((a+i)%b==0)
                c[k++]=i;
        }
        printf("%02d",c[0]);
        for(int i=1;i<k;i++)
            printf(" %02d",c[i]);//前导0格式
        printf("\n");
    }
    return 0;
}

 

hdu 2099 整除的尾数

标签:pac   time   mit   strong   memory   bit   ref   turn   problem   

原文地址:https://www.cnblogs.com/yinbiao/p/9311877.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!