結果
問題 |
No.500 階乗電卓
|
ユーザー |
|
提出日時 | 2022-02-15 19:51:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 1,333 ms |
コンパイル使用メモリ | 168,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 07:08:18 |
合計ジャッジ時間 | 2,117 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin>>N; if(N<=14){ long long answer=1; for(int i=1;i<=N;i++)answer=answer*i; cout<<answer; } else if(N>=50)cout<<"000000000000"; else { long long answer=1; for(int i=1;i<=N;i++)answer=(answer*i)%1000000000000; if(N==20||N==32){ string S=to_string(answer); int K=S.size(); K=12-K; for(int i=1;i<=K;i++)cout<<0; cout<<S; } else cout<<answer; } }