#include<bits/stdc++.h>
using namespace std;
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)
#define MOD 1000000007
#define MX 10010
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
int n, tc, kk=1;
string s;
while(cin>>n)
{
int digit=1, tmp, five=0, two=0;
for(int i=2;i<=n;i++)
{
tmp=i;
while(tmp%2==0)
{
two++;
tmp/=2;
}
while(tmp%5==0)
{
five++;
tmp/=5;
}
digit = (digit*(tmp%10))%10;
}
for(int i=five;i<two;i++)
digit=(digit*2)%10;
cout<<setw(5)<<n<<" -> "<<digit<<"\n";
}
return 0;
}
No comments:
Post a Comment