結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2020-04-18 23:14:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 437 bytes |
コンパイル時間 | 1,909 ms |
コンパイル使用メモリ | 190,920 KB |
最終ジャッジ日時 | 2025-01-09 21:19:59 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 12 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=] 19 | printf("%012d\n", ans); | ~~~~^ ~~~ | | | | int int64_t {aka long int} | %012ld main.cpp:21:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=] 21 | printf("%d\n", ans); | ~^ ~~~ | | | | int int64_t {aka long int} | %ld
ソースコード
#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 *= n; if (ans >= 1000000000000) big = true; ans %= 1000000000000; } if (big) { printf("%012d\n", ans); } else { printf("%d\n", ans); } }