結果
問題 |
No.502 階乗を計算するだけ
|
ユーザー |
![]() |
提出日時 | 2017-08-11 12:32:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 266 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 30,208 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-12 20:33:54 |
合計ジャッジ時間 | 10,860 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 26 TLE * 4 -- * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <math.h> int factorial(int n){ if(n==0){ return 1; } else{ return n * factorial(n-1); } } int main(void){ int answer=0; int n; scanf("%d", &n); answer=factorial(n); printf(" %d\n", answer); return 0; }