結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2021-04-11 18:50:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 904 ms |
コンパイル使用メモリ | 92,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 13:30:05 |
合計ジャッジ時間 | 1,779 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <vector> #include <functional> #include <algorithm> #include <map> #include <cstdio> #include <cmath> #include <iomanip> using namespace std; int main() { long long n; cin >> n; vector<long long> fact(220000 , 0); fact[0] = 1; for (int i = 1; i < 60; i++) { long long now = i * fact[i - 1] % 10000000000000; fact[i] = now; } if (n >= 50) { cout << "000000000000" << endl; } else { string s = to_string(fact[n]); if (s.size() == 13) { for (int i = 1; i < 13; i++) { cout << s[i]; } cout << endl; } else { cout << s << endl; } } return 0; }