結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2020-01-11 21:35:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 569 bytes |
コンパイル時間 | 1,369 ms |
コンパイル使用メモリ | 168,524 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 22:48:33 |
合計ジャッジ時間 | 2,107 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long signed main(){ int n; cin >> n; vector<int> dp(100001); dp[0] = dp[1] = 1; for(int i = 2; i < 100001; i++){ dp[i] = dp[i-1] * i % (int)1e12; } if(n >= 50){ cout << "000000000000" << endl; }else{ if(n >= 15){ int len = 0, t = dp[n]; while(t > 0){ len++; t /= 10; } for(int i = 0; i < 12 - len; i++){ cout << 0; } } cout << dp[n] << endl; } return 0; }