zoukankan      html  css  js  c++  java
  • HDU 2099 整除的尾数解题思路

    整除的尾数

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


    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
    #include<stdio.h>
    
    void main()
    {
        int a,b,t,count;
        scanf("%d %d",&a,&b);
        while(a != 0)
        {
            //printf("a = %d,b = %d
    ",a,b);
            t = 0;
            count = 0;
            while(t <= 99)
            {
                if((a*100 + t)%b == 0)
                {
                    count ++;
                    if(t < 10 && count > 1)
                        printf(" 0%d",t);
                    else if(t < 10 && count == 1)
                        printf("0%d",t);
                    else if(t >= 10 &&count > 1)
                        printf(" %d",t);
                    else if(t >= 10 && count == 1)
                        printf("%d",t);
                }
                if(count)
                    t += b;
                else
                    t++;
                //printf("count = %d
    ",count);
            }
            printf("
    ");
            scanf("%d %d",&a,&b);
        }
    }
  • 相关阅读:
    编译错误
    __attribute__
    strcmp-sse2-unaligned.S: No such file or directory.
    boost多线程编译出错
    QByteArray与QString的互相转换
    ffplay播放黑广播的声音
    ./configure详解
    linux发行版安装vmci.sys版本错误
    linux命令
    open函数的打开标志所在文件
  • 原文地址:https://www.cnblogs.com/zhangjialu2015/p/4552939.html
Copyright © 2011-2022 走看看