Computer Programming Contest Preparation

ToolBox - Source for: 106/10673/judged.c



/home/toolbox/public_html/solutions/106/10673/judged.c
    1 #include <stdio.h>
    2 
    3 /* @JUDGE_ID: 47124AK  A  C  */
    4 
    5 int main()
    6 {
    7     int cnt;
    8     int x;
    9     int k;
   10     int i;
   11     int j;
   12     int n1;
   13     int n2;
   14 
   15     scanf("%d ", &cnt);
   16     for (j=0; j<cnt; j++)
   17         {
   18             // for
   19             scanf("%d %d ", &x, &k);
   20             n1=x/k;
   21             n2=(x+k-1)/k;
   22             /* printf("i=%d   n1=%d    n2=%d\n",i , n1, n2); */
   23             for (i=0; x != ((n1 * i) + (n2 * (k-i))); i++);
   24             printf("%d %d\n", i, k-i);
   25         } // for
   26     return 0;
   27 }
   28