結果

問題 No.314 ケンケンパ
ユーザー Fpga18Gansn1230
提出日時 2017-10-05 18:33:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 56,308 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-11-16 21:26:48
合計ジャッジ時間 1,790 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 2 WA * 14 RE * 1
権限があれば一括ダウンロードができます

ソースコード

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