結果

問題 No.194 フィボナッチ数列の理解(1)
ユーザー latte0119latte0119
提出日時 2015-04-26 23:24:43
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 435 bytes
コンパイル時間 1,058 ms
コンパイル使用メモリ 143,624 KB
実行使用メモリ 7,528 KB
最終ジャッジ日時 2023-09-18 11:09:24
合計ジャッジ時間 6,255 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 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 13 ms
7,528 KB
testcase_21 AC 14 ms
7,420 KB
testcase_22 AC 14 ms
7,420 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 7 ms
5,356 KB
testcase_25 AC 8 ms
5,200 KB
testcase_26 AC 7 ms
5,352 KB
testcase_27 AC 8 ms
5,720 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 13 ms
7,100 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

const int mod=1e9+7;
int dp[1000010];
int N,K;

int main(){
    scanf("%d%d",&N,&K);
    for(int i=0;i<N;i++)scanf("%d",&dp[i]);
    int latte=accumulate(dp,dp+N,0ll)%mod;
    for(int i=N;i<K;i++){
        dp[i]=latte;
        latte=(latte-dp[i-N]+mod)%mod;
        latte=(latte+dp[i])%mod;
    }
    latte=accumulate(dp,dp+K,0ll)%mod;
    printf("%d %d\n",dp[K-1],latte);
    return 0;
}
0