fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <ctype.h>
  5. #include <string.h>
  6.  
  7. int main(){
  8. int t, s, totol=1, d, ans=1;
  9. int a,b;
  10. scanf("%d", &t);
  11. for(int k=0;k<t;k++){
  12. totol=1, ans=1;
  13. scanf("%d %d", &a, &b);
  14. if(b>(a-b+1)){
  15. ans=0;
  16. b=a-b;
  17. }
  18. for(int j=1;j<b+1;j++){
  19. ans *= (a-b+2-j);
  20. ans /= j;
  21. }
  22. for(int w=1;w<b+1;w++){
  23. totol *= (a-w+1);
  24. totol /= w;
  25. }
  26. s=totol;
  27. d=totol-ans;
  28. printf("%d %d\n", s, d);
  29. }
  30. }
Success #stdin #stdout 0.01s 5296KB
stdin
1
20 10
stdout
184756 184745