首页 > 代码库 > 读入a,b当a,b不同时为零时结束

读入a,b当a,b不同时为零时结束

#define LOCAL
#include<map>
#include<cstdio>
const int MAX_N=100;
int a[MAX_N],b[MAX_N];
void init()
{
    for(int i=0;i<MAX_N;i++)
    {
        a[i]=i;
    }
}
int main()
{
#ifdef LOCAL
    freopen("842.in","r",stdin);
    freopen("842.out","w",stdout);
#endif    
    int m,n,temp,sum=0;
    init();
    while(~scanf("%d%d",&m,&n)&&m&&n)
    {
        m=m*100,sum=0;
        for(int i=0;i<MAX_N;i++)
        {
            temp=m+i;
            if(temp%n){
                
            }else{
                b[sum++]=a[i];
            }
        }
        for(int i=0;i<sum-1;i++)
        {
            if(b[i]<10)    printf("0%d ",b[i]);
            else printf("%d ",b[i]);
        }
        if(sum>=1)
        {
            if(b[sum-1]<10)    printf("0%d\n",b[sum-1]);
            else printf("%d\n",b[sum-1]);
        }
    }    
    return 0;
}