結果
問題 |
No.314 ケンケンパ
|
ユーザー |
|
提出日時 | 2018-04-02 22:37:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 383 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 9,216 KB |
最終ジャッジ日時 | 2024-06-26 06:49:57 |
合計ジャッジ時間 | 906 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%lld",&N); | ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h> long long dp[1000000]; int main(void){ // Your code here! long long N; scanf("%lld",&N); dp[1] = 0; dp[2] = 1; dp[3] = 1; for(int i = 4; i <= N; i++){ dp[i] = (dp[2]*dp[i-2])%1000000007 + (dp[3]*dp[i-3])%1000000007; } if(N >= 3) printf("%lld\n",(dp[N]+dp[N-1]+dp[N-2])%1000000007); else printf("1\n"); }