結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-27 18:00:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 418 bytes |
| コンパイル時間 | 1,515 ms |
| コンパイル使用メモリ | 167,696 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 20:50:00 |
| 合計ジャッジ時間 | 2,364 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
unsigned long long n, ans = 1, mod = 1e12;
cin >> n;
for(int i = 1; i <= n; i++) {
ans *= i;
ans %= mod;
if(i == 50){
cout << "000000000000" << endl;
return 0;
}
}
printf(n >= 15 ? "%012lld\n": "%lld\n", ans);
return 0;
}