fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. long double silnia(int n)
  6. {
  7. if (n==0) return 1;
  8. else return n*silnia(n-1);
  9. }
  10.  
  11. int ile, a,b,c;
  12. long double x,y,z,d;
  13.  
  14. int main()
  15. {
  16. cin >> ile;
  17. for (int i=1; i<=ile; i++)
  18. {
  19. cin >> a >> b;
  20. c=a-b;
  21. x=silnia(a);
  22. y=silnia(b);
  23. z=silnia(c);
  24.  
  25. d=x/(z*y);
  26.  
  27. cout << d << endl;
  28. }
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 3416KB
stdin
3
0 0
7 3
1000 2
stdout
1
35
499500