| 记录编号 | 47291 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 861.阶乘 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.005 s | ||
| 提交时间 | 2012-10-31 19:43:17 | 内存使用 | 13.66 MiB | ||
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main(){
freopen("fact4.in","r",stdin);
freopen("fact4.out","w",stdout);
int n,i,s=1,x;
scanf("%d",&n);
for(i=2;i<=n;i++){
x=i;
while(x%10==0) x/=10;
s*=x;
if(s%10==0) s/=10;
s%=10000;
}
s%=10;
printf("%d",s);
return 0;
}