結果

問題 No.978 Fibonacci Convolution Easy
ユーザー Apppp11Apppp11
提出日時 2020-02-01 02:46:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 1,683 ms
コンパイル使用メモリ 66,780 KB
実行使用メモリ 19,280 KB
最終ジャッジ日時 2023-10-18 21:59:04
合計ジャッジ時間 3,924 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

    long long a[2000000],p,n,sum=0,expsum=0;
    const long long MOD=1000000007;
    bool oe=false;

long long llmod(long long x){
    return x%MOD;
}
int main(void){
    // Your code here!
    cin>>n>>p;
    for(long long i=0;i<n;i++){
        if(i<2)a[i]=i;
        else a[i]=llmod(llmod(a[i-1]*p)+a[i-2]);
        sum=llmod(sum+a[i]);
        expsum=llmod(expsum+llmod(a[i]*a[i]));
    }
    cout<<llmod((llmod(llmod(sum*sum)+expsum)+((((sum*sum/MOD)+(expsum/MOD))%2)?MOD:0))/2)<<endl;
    return 0;
}
0