Advertisement
erfanul007

UVa 10212

Jun 1st, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5.  
  6. int main()
  7. {
  8. ll n, m;
  9. while(cin>>n>>m){
  10. if(m==0){
  11. cout<<1<<'\n';
  12. continue;
  13. }
  14. ll ans =1,x=n-m;
  15. for(int i=n;i>x;i--){
  16. ans*=i;
  17. while(ans%10==0){
  18. ans/=10;
  19. }
  20. ans%=10000000000;
  21. }
  22. cout<<ans%10<<'\n';
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement