結果

問題 No.194 フィボナッチ数列の理解(1)
ユーザー tailstails
提出日時 2015-04-26 23:13:48
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 538 bytes
コンパイル時間 1,103 ms
コンパイル使用メモリ 144,092 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-18 09:41:39
合計ジャッジ時間 2,588 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 9 ms
4,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;

#define mod 1000000007

int A[10000];

main(){
  int n,k;
  std::cin >> n >> k;
  if(k<=1000000){
    // case 1-10
    int s=0;
    int a;
    for(int i=0;i<n;++i){
      std::cin >> a;
      s=(s+a)%mod;
      A[i]=a;
    }
    int t=s;
    for(int i=n;i<k;++i){
      a=t;
      t=(t*2-A[i%n]+mod)%mod;
      s=(s+a)%mod;
      A[i%n]=a;
    }
    std::cout << a << " " << s << std::endl;
  }else{
    // case 11-20
    std::cout << "wakannai" << std::endl;
    exit(2);
  }
  return 0;
}
0