1 #include <iostream> 2 using namespace std; 3 4 int main() { 5 int n; 6 cin >> n; 7 int c = 1, a = 0, b = 0; 8 for(int i = 1; i <= n; i++) { 9 int x = i; 10 while(x % 2 == 0) x /= 2, a++; 11 while(x % 5 == 0) x /= 5, b++; 12 c = (c * x) % 10; 13 } 14 for(int i = 0; i < a - b; i++) { 15 c = (c * 2) % 10; 16 } 17 cout << c << endl; 18 return 0; 19 }
标签:洛谷,int,题解,USACO3.2,阶乘,P1134 From: https://www.cnblogs.com/xioa-chou/p/16858136.html