daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Aug 11th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.  
  7.     int t,i,x[1000],y[1000],z[1000];
  8.     static int a[100],b[100];
  9.     scanf("%d",&t);
  10.     for(i=0;i<t;i++)
  11.     {
  12.         scanf("%d%d%d",&x[i],&y[i],&z[i]);
  13.     }
  14.     for(i=0;i<t;i++)
  15.     {
  16.         while(z[i]!=1)
  17.         {
  18.             if((x[i]%z[i]==0)||(y[i]%z[i]==0))
  19.             {
  20.                 if(x[i]%z[i]==0)
  21.                 {
  22.                     x[i]--;
  23.                     a[i]++;
  24.                 }
  25.                 if(y[i]%z[i]==0)
  26.                 {
  27.                     y[i]--;
  28.                     b[i]++;
  29.                 }
  30.             }
  31.             else
  32.             {
  33.                 z[i]--;
  34.             }
  35.         }
  36.     }
  37.     for(i=0;i<t;i++)
  38.     {
  39.         printf("%d %dn",a[i],b[i]);
  40.     }
  41.     return 0;
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top