結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
rsk0315
|
| 提出日時 | 2020-04-08 04:30:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 275 bytes |
| 記録 | |
| コンパイル時間 | 216 ms |
| コンパイル使用メモリ | 27,648 KB |
| 最終ジャッジ日時 | 2025-01-09 15:03:58 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 TLE * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%jd", &n);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdint>
intmax_t const mod = 1000'000'007;
int main() {
intmax_t n;
scanf("%jd", &n);
if (n >= mod) return puts("0"), 0;
intmax_t res = 1;
for (intmax_t i = 1; i <= n; ++i) (res *= i) %= mod;
printf("%jd\n", res);
}
rsk0315