社区讨论
这样也可以。。
P1134[USACO3.2] 阶乘问题参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mi6mqpup
- 此快照首次捕获于
- 2025/11/20 07:24 4 个月前
- 此快照最后确认于
- 2025/11/20 07:24 4 个月前
CPP
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
#define Temp template<typename T>
using namespace std;
typedef long long LL;
Temp inline void read(T &x){//快速读入
x=0;T w=1,ch=getchar();
while(!isdigit(ch)&&ch!='-')ch=getchar();
if(ch=='-')w=-1,ch=getchar();
while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
x=x*w;
}
LL n,ans=1;
int main(){
read(n);
for(register LL i=1;i<=n;i++){
ans=ans*i;//直接模拟就可以啦!!!
while(ans%10==0)ans/=10;
ans%=100000000;
}
cout<<ans%10<<endl;
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...