結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
nassy_moten
|
| 提出日時 | 2018-11-17 22:28:19 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 453 bytes |
| 記録 | |
| コンパイル時間 | 404 ms |
| コンパイル使用メモリ | 76,884 KB |
| 実行使用メモリ | 27,136 KB |
| 最終ジャッジ日時 | 2026-05-30 10:23:20 |
| 合計ジャッジ時間 | 1,524 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 7 WA * 10 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:10: warning: 'a' is used uninitialized [-Wuninitialized]
19 | a+=dp[n][i]%bba;
| ~^~~~~~~~~~~~~~
main.cpp:17:15: note: 'a' was declared here
17 | long long a;
| ^
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long dp[1001000][3]={};
int main(){
int bba=1000000007;
int n;
cin>>n;
dp[1][1]=1;
dp[1][0]=dp[1][2]=0;
for(int i=1;i<=n+5;i++){
dp[i][0]+=(dp[i-1][1]+dp[i-1][2])%bba;
dp[i][1]+=dp[i-1][0]%bba;
dp[i][2]+=dp[i-1][1]%bba;
}
long long a;
for(int i=0;i<3;i++){
a+=dp[n][i]%bba;
}
cout<<a<<endl;
}
nassy_moten