天天看點

hdu2099 整除的尾數

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>

int main()

{

    int a,b,i,l;

    while(scanf("%d%d",&a,&b)&&a+b)

    {

    l=0;

    for(i=0;i<100;i++)

    {

    if((i+(a*100))%b==0)

    {

    if(l==0)

    printf("%02d",i);

    else printf(" %02d",i);  //處理行末空格

    l++;

    }

    }

    printf("\n");

    }

return 0;

}

OJ好像不識别“/b”,關鍵就是行末的空格