結果

問題 No.314 ケンケンパ
ユーザー Fpga18Gansn1230Fpga18Gansn1230
提出日時 2017-10-05 18:33:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 54,364 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-28 07:50:04
合計ジャッジ時間 1,389 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 6 ms
11,136 KB
testcase_02 AC 6 ms
11,136 KB
testcase_03 WA -
testcase_04 AC 5 ms
11,136 KB
testcase_05 AC 6 ms
11,136 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  long long int map[1000000]={0};
  map[0]=1;
  map[1]=1;
  map[2]=1;
  for(int i=1;i<N;i++){
    if(map[i]!=0){
      map[i+2]=(map[i+2]+map[i]+1)%1000000007;
      map[i+3]=(map[i+3]+map[i]+1)%1000000007;
    }
  }
  long long int sum=0;
  if(N==1){
    sum=map[N-1];
  }else{
    sum=(map[N-1]+map[N-2])%1000000007;
  }
  cout << sum<< endl;
}
0