結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2020-04-18 23:16:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 2,675 ms |
コンパイル使用メモリ | 190,816 KB |
最終ジャッジ日時 | 2025-01-09 21:20:20 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; if (n >= 50) { puts("000000000000"); return 0; } bool big = false; int64_t ans = 1; for (int i = 1; i <= n; i++) { ans *= i; if (ans >= 1000000000000) big = true; ans %= 1000000000000; } if (big) { printf("%012ld\n", ans); } else { printf("%ld\n", ans); } }