結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-08 00:03:00 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 429 bytes |
| コンパイル時間 | 466 ms |
| コンパイル使用メモリ | 20,736 KB |
| 実行使用メモリ | 812,800 KB |
| 最終ジャッジ日時 | 2024-07-16 03:28:12 |
| 合計ジャッジ時間 | 3,463 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | MLE * 1 -- * 51 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:19:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%lld",&n);
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
long long fact(long long s,long long e){
if(e==s) return e;
long long ans=1;
if((e-s+1)%2==1){
ans=e;
e--;
}
ans*=fact(s,s+(e-s+1)/2-1);
ans%=1000000007;
ans*=fact(s+(e-s+1)/2,e);
ans%=1000000007;
return ans;
}
int main(int argc, char const *argv[]){
long long n,p=1000000007,ans=1,i;
scanf("%lld",&n);
if(n<p){
ans=fact(1,n);
printf("%lld\n",ans);
}else{
printf("0\n");
}
return 0;
}