結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2017-07-22 22:06:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 390 ms |
| コンパイル使用メモリ | 53,840 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 03:02:54 |
| 合計ジャッジ時間 | 1,220 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
int main(int argc, char *argv[])
{
LL n, ans = 1;
cin >> n;
for (LL i = 1; ans && i <= n; ++i) {
ans = (ans * i) % 1000000000000;
}
if (n <= 14) {
cout << ans << endl;
} else {
printf("%012lld\n", ans);
}
return 0;
}
hotpepsi