#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
int sum = 1;
for (int i = 1; i <= n; ++i) {
sum *= i;
while (sum % 10 == 0) {
sum /= 10;
}
sum %= 10000;//这里不能写10
}
cout << sum % 10 << endl;
return 0;
}
acwing1381. 阶乘
最新推荐文章于 2024-04-11 00:41:04 发布