結果

問題 No.500 階乗電卓
ユーザー legosuke
提出日時 2021-08-08 05:32:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 193,336 KB
最終ジャッジ日時 2025-01-23 16:54:14
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int64_t N;
    cin >> N;
    if (N >= 50) {
        cout << setfill('0') << right << setw(12) << 0 << endl;
    } else {
        const int64_t MOD = 1'000'000'000'000;
        int64_t ans = 1;
        for (int i = 1; i <= N; ++i) {
            (ans *= i) %= MOD;
        }
        cout << setfill('0') << right << setw(12) << ans << endl;
    }
    return 0;
}
0