結果
| 問題 |
No.502 階乗を計算するだけ
|
| コンテスト | |
| ユーザー |
taifutennis
|
| 提出日時 | 2017-08-11 12:30:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 30,848 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-10-12 20:32:59 |
| 合計ジャッジ時間 | 10,880 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 39 TLE * 4 -- * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | 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);
}
}
double mo(int a){
int m;
int ret;
m=10*10*10*10*10*10*10*10*10+7;
ret=a %m;
return ret;
}
int main(void){
int answer=0;
int n;
double ans=0;
scanf("%d", &n);
answer=factorial(n);
ans=mo(answer);
printf(" %f", ans);
return 0;
}
taifutennis