HDOJ 2099

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

#include <stdio.h>
#include <list>
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){
        if(a==0&&b==0)
            return 0;
        list<int>    L;
        int i,j;    
        for(i=0;i<=9;i++)
            for(j=0;j<=9;j++)
                if((a*100+10*i+j)%b==0)
                    L.push_back(10*i+j);
        while(!L.empty()){
            printf("%02d",L.front());
            if(L.size()!=1)
                putchar(' ');
            else putchar('\n');
            L.pop_front();
        }
    }
}
posted @ 2011-10-20 22:45  linyvxiang  阅读(123)  评论(0编辑  收藏  举报