标签:name end main return std str == include ble
#include<iostream>
#include<math.h>
using namespace std;
int a=0, b=0;
int main(){
long long int n, ans=1, t;
cin>>n;
for(int i=1; i<=n; i++){
t=i;
while(t%2==0){
a++;
t/=2;
}
while(t%5==0){
b++;
t/=5;
}
if(t!=0)
ans*=t;
ans=ans%10;
}
if(a>b){
switch((a-b)%4){
case 0: ans=ans*6; break;
case 1: ans=ans*2; break;
case 2: ans=ans*4; break;
case 3: ans=ans*8; break;
default: break;
}
}else if(b>a)
ans*=5;
ans=ans%10;
cout<<ans<<endl;
return 0;
}
标签:name end main return std str == include ble
原文地址:https://www.cnblogs.com/A-Little-Nut/p/10360413.html