結果
問題 |
No.554 recurrence formula
|
ユーザー |
![]() |
提出日時 | 2018-01-04 17:25:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,435 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 953 ms |
コンパイル使用メモリ | 74,256 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 03:43:39 |
合計ジャッジ時間 | 4,387 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cmath> #include <stack> #include <cctype> using namespace std; long long a[100000]; int main() { int n=0; cin>>n; a[1] =1; a[2] =2; long long sum =0; for(int i=3; i<=n;i++){ sum=0; for(int j=i-1; j>=1; j -=2){ sum += a[j]; } a[i] =i*sum%1000000007; } cout<<a[n]<<endl; return 0; }