提交时间:2024-08-20 21:35:28

运行 ID: 173566

#include <iostream> using namespace std; int main() { int n; cin >> n; int num[100000]; num[0] = 1; num[1] = 1; for (int i = 2 ; i <= n ; i ++) { int temp = 0; for(int j = 1 ; j <= num[0] ; j ++) { num[j] = num[j] * i + temp; temp = num[j] / 10; num[j] = num[j] % 10; } while (temp) { num[0] ++; num[num[0]] = temp % 10; temp = temp / 10; } } cout << n << "!="; for (int i = num[0] ; i >= 1 ; i --) cout << num[i]; }