Saleh127

UVA 10219

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