結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2018-06-12 19:58:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 1,000 ms |
コード長 | 491 bytes |
コンパイル時間 | 1,487 ms |
コンパイル使用メモリ | 167,032 KB |
実行使用メモリ | 7,276 KB |
最終ジャッジ日時 | 2024-06-30 13:55:00 |
合計ジャッジ時間 | 2,227 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define fastcin {\cin.tie(0);\ios::sync_with_stdio(false);\}#define rep(i, a, b) for(int i = a; i < b; i++)#define print(x) cout << x << "\n"#define MOD 1000000007int a[1000001];int getA(int n) {a[1] = 1;a[2] = 2;a[3] = 2;rep(i, 4, n+1) {a[i] = (a[i-2] + a[i-3])%MOD;}return a[n];}int main() {fastcin;int n, ans;cin >> n;ans = getA(n);print(ans);return 0;}