fork(1) download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. int a,b,c,t,y;
  6. scanf("%d %d %d",&a,&b,&c);
  7. printf("%d ",(a+b)/c);
  8. t=a%c;y=b%c;
  9. if(y==b)y=0;
  10. if(t==a)t=0;
  11. if(t<y)printf("%d ",t);
  12. else printf("%d ",y);
  13. return 0;
  14. }
  15.  
  16.  
Success #stdin #stdout 0s 4388KB
stdin
500 4 55
stdout
9 0