Advertisement
erfanul007

UVa 530

Mar 12th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef unsigned long long int ull;
  5. typedef long long int ll;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef pair<int,int > pii;
  9. typedef vector< pii > vpii;
  10.  
  11. #define sc scanf
  12. //#define pf printf
  13. #define sci(n) scanf("%d",&n)
  14. #define scl(n) scanf("%lld",&n)
  15. #define scd(n) scanf("%lf",&n)
  16. #define scs(s) scanf("%s",s)
  17. #define pfi(n) printf("%d",n)
  18. #define pfl(n) printf("%lld",n)
  19. #define pff(n) cout<<n
  20. #define line printf("\n")
  21. #define spc printf(" ")
  22. #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
  23. #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
  24. #define cspf(i) printf("Pair #%d: ", i)
  25. #define pb push_back
  26. #define mp make_pair
  27. #define ff first
  28. #define ss second
  29. #define all(v) v.begin(),v.end()
  30. #define rall(v) v.rbegin(),v.rend()
  31. #define read() freopen("input.txt", "r", stdin)
  32. #define write() freopen("output.txt", "w", stdout)
  33. /// Constants
  34. #define eps 1e-9
  35. #define inf (1e6)+9
  36. #define PI acos(-1.0) // 3.1415926535897932
  37. #define MAX 1000009
  38.  
  39.  
  40. int main()
  41. {
  42. int n,r;
  43. while(1){
  44. sci(n);sci(r);
  45. if(n==0) break;
  46. if(r>n/2){
  47. r=n-r;
  48. }
  49. ll ans=1;
  50. for(int i=0;i<r;i++){
  51. ans*=(n-i);
  52. ans/=(i+1);
  53. }
  54. pfl(ans);line;
  55. }
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement