結果
問題 |
No.314 ケンケンパ
|
ユーザー |
|
提出日時 | 2018-04-02 22:38:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 9 ms / 1,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 9,344 KB |
最終ジャッジ日時 | 2024-06-26 06:49:58 |
合計ジャッジ時間 | 888 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
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 if( N == 2 )printf("2\n"); else printf("1\n"); }