結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2015-12-25 17:39:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 28 ms / 1,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 33,732 KB |
実行使用メモリ | 26,700 KB |
最終ジャッジ日時 | 2024-09-18 23:54:19 |
合計ジャッジ時間 | 1,243 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int a;scanf("%d",&a); | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h>#include<algorithm>using namespace std;long long mod=1000000007;long long dp[1100000][3];int main(){int a;scanf("%d",&a);dp[0][0]=1;for(int i=1;i<=a;i++){dp[i][0]=(dp[i-1][1]+dp[i-1][2])%mod;dp[i][1]=(dp[i-1][0])%mod;dp[i][2]=dp[i-1][1];}printf("%lld\n",(dp[a][0]+dp[a][1]+dp[a][2])%mod);}