zoukankan      html  css  js  c++  java
  • 训练1-K

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

    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>
    #include <string.h>
    #include <stdlib.h>
    int main()
    {
        int n,m,i;
        int a[10010],t=0;
        while (~scanf("%d %d",&n,&m))
        {
            t=0;
            memset(a,0,sizeof(a));        //目的是将a数组全部置0,用memset效率高
            if(n==0&&m==0)
                break;
            n=n*100;
            for(i=0;i<=99;i++)
            {
                if((n+i)%m==0)
                    {
                        a[t]=i;
                        t++;
                    }
            }
            for(i=0;i<t-1;i++)
                printf("%02d ",a[i]);    //限制输出位数
            printf("%02d
    ",a[t-1]);
        }
        return 0;
    }

  • 相关阅读:
    测试
    pytest -- Windows fatal exception: code 1073807366
    cookie绕过验证码登录操作
    python接口自动化基本流程
    测试-pytest框架
    测试
    flask框架
    阿里巴巴集团面试
    字节跳动一面
    mysql 存储引擎
  • 原文地址:https://www.cnblogs.com/aerer/p/9931071.html
Copyright © 2011-2022 走看看