Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- int main()
- {
- ll n, m;
- while(cin>>n>>m){
- if(m==0){
- cout<<1<<'\n';
- continue;
- }
- ll ans =1,x=n-m;
- for(int i=n;i>x;i--){
- ans*=i;
- while(ans%10==0){
- ans/=10;
- }
- ans%=10000000000;
- }
- cout<<ans%10<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement