/* Date:2018-9-28 Author:Shimmer|mote */ #include<iostream> #include<cstdio> #include<cstring> using namespace std; int arr[500000]; int main() { int n; while (scanf("%d", &n) != EOF) { memset(arr, 0, sizeof(arr)); int m = 1; arr[0] = 1; arr[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <= m; j++) {//m为阶乘的位数 arr[j] *= i; } for (int j = 1; j <= m; j++) { if (arr[j] > 9) { arr[j+1] += arr[j]/10; arr[j] = arr[j]%10; } if (arr[m+1] != 0) //进位 m += 1; } } for (int j = m; j >= 1; j--) { printf("%d", arr[j]); } printf(" "); } }