結果
問題 |
No.500 階乗電卓
|
ユーザー |
|
提出日時 | 2020-04-15 21:10:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 67,200 KB |
最終ジャッジ日時 | 2025-01-09 19:19:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 2 |
ソースコード
#include <iostream> #include <string> using lint = long long; constexpr lint MOD = 1e12; void solve() { lint n; std::cin >> n; lint ans = 1; for (lint i = 1; i <= n; ++i) { (ans *= i) %= MOD; if (ans == 0) break; } if (ans == 0) { std::cout << std::string(12, '0') << std::endl; } else { std::cout << ans << std::endl; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }