結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2019-04-19 11:06:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 39 ms / 1,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 1,541 ms |
コンパイル使用メモリ | 158,576 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-22 11:22:05 |
合計ジャッジ時間 | 2,123 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1000000007; int main() { ios::sync_with_stdio(false); ll n; cin >> n; ll dp[n+1]; dp[0] = 1; dp[1] = 1; dp[2] = 2; for (int i = 3; i <= n; i++) { dp[i] = (dp[i-2]%mod + dp[i-3]%mod)%mod; } cout << dp[n] << endl; return 0; }