Advertisement
Farjana_akter

Untitled

May 27th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long int n,r,k,i,j,a,b,c;
  7. double ans=0.0;
  8. while(cin>>n>>r)
  9. {
  10. a=min(r,n-r);
  11. ans=0.0;
  12. b=n-a+1;
  13. for(i=b;i<=n;i++)
  14. ans+=log10(i);
  15. for(i=1;i<=a;i++)
  16. ans-=log10(i);
  17.  
  18. ans=floor(ans)+1;
  19. cout<<ans<<endl;
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement