Advertisement
noshin98

uva 11219

Jan 8th, 2017
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<cmath>
  3. #define ll long long
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.   unsigned ll n,k;
  10.   long double sum;
  11.  
  12.  while(cin>>n>>k)
  13.  {
  14.   sum=0;
  15.  
  16.   for( unsigned ll i=n-k+1; i<=n; i++)
  17.   {
  18.    sum+=log10((double)i);
  19.   }
  20.  
  21.    for( unsigned ll j=1; j<=k; j++)
  22.    {
  23.     sum-=log10((double)j);
  24.    }
  25.  
  26.    cout<<(ll)sum+1<<endl;
  27.   }
  28.  return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement