整除的尾數(2099)

整除的尾數

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


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> #include <stdlib.h> int main() {     int m,n,i;      while(scanf("%d%d",&m,&n)!=EOF)      {          int k;           if(m==0&&n==0)             break;             m=(m%n)*100;             for(i=0,k=0;i<100;i++)             {                 if(m%n==0)                 {                     if(k==0)                     {                         k=1;                         printf("%02d",m%100);                     }                   else                         printf(" %d",m%100);                 }                         m++;             }             printf("\n");      }     return 0; }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章