結果
問題 |
No.500 階乗電卓
|
ユーザー |
|
提出日時 | 2020-11-05 15:36:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 731 bytes |
コンパイル時間 | 1,480 ms |
コンパイル使用メモリ | 166,732 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 11:12:07 |
合計ジャッジ時間 | 2,217 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 2 |
ソースコード
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair<ll, ll> pll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; ll MOD = pow(10, 12); if (N >= 65) { cout << "000000000000" << endl; return 0; } else { ll sum = 1; for (int i = N; i > 0; i--) { sum *= i; sum %= MOD; if (sum == 0) { cout << "000000000000" << endl; return 0; } } cout << sum << endl; } }