結果

問題 No.797 Noelちゃんとピラミッド
ユーザー septillionth24
提出日時 2019-03-15 22:31:33
言語 C++14
(gcc 8.2.0)
結果
RE   .
実行時間 -
コード長 597 Byte
コンパイル時間 1,303 ms
使用メモリ 1,496 KB
最終ジャッジ日時 2019-06-28 11:28:28

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
001sample.txt AC 2 ms
1,496 KB
002sample.txt AC 3 ms
1,492 KB
003sample.txt AC 2 ms
1,492 KB
LEARGE_case1.txt RE -
LEARGE_case2.txt RE -
LEARGE_case3.txt RE -
LEARGE_case4.txt RE -
LEARGE_case5.txt RE -
LEARGE_case6.txt RE -
LEARGE_case7.txt RE -
LEARGE_case8.txt RE -
LEARGE_case9.txt RE -
LEARGE_case10.txt RE -
LEARGE_case11.txt RE -
LEARGE_case12.txt RE -
LEARGE_case13.txt RE -
LEARGE_case14.txt RE -
LEARGE_case15.txt RE -
LEARGE_case16.txt RE -
LEARGE_case17.txt RE -
LEARGE_case18.txt RE -
LEARGE_case19.txt RE -
LEARGE_case20.txt RE -
RANDOM_case1.txt RE -
RANDOM_case2.txt RE -
RANDOM_case3.txt RE -
RANDOM_case4.txt RE -
RANDOM_case5.txt RE -
RANDOM_case6.txt RE -
RANDOM_case7.txt RE -
RANDOM_case8.txt RE -
RANDOM_case9.txt RE -
RANDOM_case10.txt RE -
RANDOM_case11.txt RE -
RANDOM_case12.txt RE -
RANDOM_case13.txt RE -
RANDOM_case14.txt RE -
RANDOM_case15.txt RE -
RANDOM_case16.txt RE -
RANDOM_case17.txt RE -
RANDOM_case18.txt RE -
RANDOM_case19.txt RE -
RANDOM_case20.txt RE -
SMALL_case1.txt RE -
SMALL_case2.txt RE -
SMALL_case3.txt RE -
SMALL_case4.txt WA -
SMALL_case5.txt WA -
SMALL_case6.txt WA -
SMALL_case7.txt WA -
SMALL_case8.txt WA -
SMALL_case9.txt RE -
SMALL_case10.txt WA -
SMALL_case11.txt WA -
SMALL_case12.txt AC 3 ms
1,492 KB
SMALL_case13.txt RE -
SMALL_case14.txt RE -
SMALL_case15.txt RE -
SMALL_case16.txt AC 2 ms
1,492 KB
SMALL_case17.txt WA -
SMALL_case18.txt WA -
SMALL_case19.txt WA -
SMALL_case20.txt RE -
テストケース一括ダウンロード

ソースコード

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

long product_n2k(long n,long k){
    if (n == 0){
        return 1;
    } else if (n == k) {
        return n;
    }else {
        return n * product_n2k(n - 1, k);
    }
}

long bi_coefficient(long n, long k){
    if (k == 0)
        return 1;
    else
        return product_n2k(n, n - k + 1) / product_n2k(k, 1);
}

int main (){
    long long N,x,y;
    long long ans=0;
    cin >> N;
    for(long long i=0;i<N;i++){
        cin >> y;
        x=bi_coefficient(N-1,i);
        ans += y*x;
        ans %= 1000000007;
    }
    cout << ans << endl;
}
0