結果

問題 No.554 recurrence formula
ユーザー rapurasurapurasu
提出日時 2017-08-11 22:37:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 158,468 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 22:52:43
合計ジャッジ時間 1,878 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 5 ms
6,944 KB
testcase_20 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL MOD=1e9+7;
int n;
LL a[100001];
LL odd=1;
LL even=0;
/*LL f(int n){
   if(a[n]!=-1)return a[n];
   if(n==0)return 0;
   if(n==1)return 1;
   LL ans=0;
   if(n%2==0){
      for(int i=0;i*2+1<n;i++){
          ans+=
      }
   }else{
   }
   a[i]=n*ans;
   return a[i];
}*/
int main(){
    cin>>n;
    for(int i=2;i<n+1;i++){
        if(i%2==0){
           a[i]=(odd*i)%MOD;
           even=(even+a[i])%MOD;
        }else{
           a[i]=(even*i%MOD);
           odd=(odd+a[i])%MOD;
        }
    }
    cout<<a[n]<<endl;
	return(0);
}
0