Saleh127

UVA 10212

Jul 18th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 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. #define mod 1000000000
  7. int main()
  8. {
  9. fellow_junior
  10. ll n,p,ans,c,d,i,j,k,l;
  11. while(cin>>n>>p)
  12. {
  13. ans=1;
  14. c=n-p;
  15. for(i=n;i>c;i--)
  16. {
  17. ans*=i;
  18. while(ans%10==0)
  19. {
  20. ans/=10;
  21. }
  22. ans%=mod;
  23. }
  24. cout<<ans%10<<endl;
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment