結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2020-11-27 00:55:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 1,889 ms |
コンパイル使用メモリ | 169,936 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 21:08:22 |
合計ジャッジ時間 | 2,455 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;const long long MOD = 1000000000000;int main(){long long N;cin >> N;if (N >= 50){cout << "000000000000" << endl;} else {long long ans = 1;bool big = false;for (int i = 1; i <= N; i++){ans *= i;if (ans >= MOD){big = true;ans %= MOD;}}string S = to_string(ans);if (big){while (S.size() < 12){S = '0' + S;}}cout << S << endl;}}