結果
問題 |
No.554 recurrence formula
|
ユーザー |
![]() |
提出日時 | 2017-08-11 22:33:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 1,476 ms |
コンパイル使用メモリ | 166,052 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:16:12 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 1 |
ソースコード
#include "bits/stdc++.h" #define MOD 1000000007 #define INF 11234567890 #define in std::cin #define out std::cout #define rep(i,N) for(int i=0;i<N;++i) typedef long long int LL; LL N; LL one = 1, two, ans; int main() { in >> N; for (LL i = 2; i <= N; ++i) { if (i % 2 == 0) { ans = i*one; ans %= MOD; two += ans; two %= MOD; } else { ans = i*two; ans %= MOD; one += ans; one %= MOD; } } out << ans << std::endl; return 0; }