結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
coderkc
|
| 提出日時 | 2019-06-06 02:00:40 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 347 bytes |
| 記録 | |
| コンパイル時間 | 315 ms |
| コンパイル使用メモリ | 71,756 KB |
| 実行使用メモリ | 11,300 KB |
| 最終ジャッジ日時 | 2026-04-10 23:50:26 |
| 合計ジャッジ時間 | 3,598 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 WA * 1 TLE * 1 -- * 19 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:11:27:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:17:8: note: 'ret' was declared here
17 | ll ret;
| ^~~
main.cpp: In function 'long long int makeFactrial(long long int)':
main.cpp:22:12: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized]
22 | return ret;
| ^~~
main.cpp:17:8: note: 'ret' was declared here
17 | ll ret;
| ^~~
ソースコード
#include <iostream>
#define ll long long
using namespace std;
ll mod = 1000000007;
ll makeFactrial(ll a);
int main(){
ll N;
cin >>N;
cout << makeFactrial(N) << endl;
return 0;
}
ll makeFactrial(ll a){
ll pre = 1;
ll ret;
for(ll i=1;i<=a;i++){
ret = (i * pre) % mod;
pre = ret;
}
return ret;
}
coderkc