Saleh127

UVA 369.cpp

Jul 2nd, 2020 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9.  
  10. ll a,c,d,e,f,i,j,k,l;
  11. while(cin>>a>>c &&a &&c)
  12. {
  13. e=a;
  14. f=c;
  15. if(c>(a/2))
  16. {
  17. c=a-c;
  18. }
  19. d=1;
  20. for(i=0;i<c;i++)
  21. {
  22. d*=(a-i);
  23. d/=(i+1);
  24. }
  25. cout<<e<<" things taken "<<f<<" at a time is "<<d<<" exactly."<<endl;
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment