結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
coderkc
|
| 提出日時 | 2019-06-06 02:02:50 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 399 bytes |
| 記録 | |
| コンパイル時間 | 317 ms |
| コンパイル使用メモリ | 71,752 KB |
| 実行使用メモリ | 11,304 KB |
| 最終ジャッジ日時 | 2026-04-11 00:02:21 |
| 合計ジャッジ時間 | 3,532 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 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:20:8: note: 'ret' was declared here
20 | ll ret;
| ^~~
main.cpp: In function 'long long int makeFactrial(long long int)':
main.cpp:25:12: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized]
25 | return ret;
| ^~~
main.cpp:20:8: note: 'ret' was declared here
20 | 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){
if (a == 0){
return 1;
}else{
ll pre = 1;
ll ret;
for(ll i=1;i<=a;i++){
ret = (i * pre) % mod;
pre = ret;
}
return ret;
}
}
coderkc