提交时间:2024-08-20 23:06:48
运行 ID: 173656
#include <bits/stdc++.h> using namespace std; void gjdcf(vector<int>& res, int x) { int c = 0; for (int i = 0; i < res.size(); i++) { int p = res[i] * x + c; res[i] = p % 10; c = p / 10; } while (c) { res.push_back(c % 10); c /= 10; } } void jc(int n) { vector<int> res(1, 1); for (int i = 2; i <= n; i++) { gjdcf(res, i); } cout << n << "!="; for (auto it = res.rbegin(); it != res.rend(); ++it) { cout << *it; } cout << endl; } int main() { int n; cin >> n; jc(n); return 0; }