提交时间:2024-08-20 14:50:35

运行 ID: 168928

#include <iostream> using namespace std; int a[1000] = {1, 0}; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { a[0] *= i; for (int j = 0; j < 1000; ++j) { if (a[j] >= 10) { a[j + 1] += a[j] / 10; a[j] %= 10; } } } int i = 999; while (!a[i]) --i; cout << n << "!="; for (int j = 0; j <= i; ++j) cout << a[j]; }