結果

問題 No.797 Noelちゃんとピラミッド
ユーザー tomarint
提出日時 2019-03-15 22:33:44
言語 C++14
(gcc 8.2.0)
結果
TLE  
実行時間 -
コード長 887 Byte
コンパイル時間 387 ms
使用メモリ 2,788 KB
最終ジャッジ日時 2019-05-07 13:31:20

テストケース

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

ソースコード

diff #
#include <iostream>
using namespace std;

int main2()
{
    long long N, i;
    cin >> N;
    long long N2 = N / 2;
    long long a[100001];
    long long b[100001];
    long long ans = 0;
    b[0] = 1;
    for (i = 1; i < N2+1; ++i) {
        b[i] = b[i-1]*(N-i)/i;
        cout << i << " " << b[i] << endl;
    }
    for (i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for (i = 0; i < N2; ++i) {
        ans += (a[i]+a[N-1-i])*b[i];
        ans %= 1000000007;
    }
    if (N%2 == 1) {
        ans += a[N2]*b[N2];
    }
    cout << ans % 1000000007 << endl;
    return 0;
}

int main()
{
    int N, i, j;
    cin >> N;
    int a[100001];
    for (i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for (i = N-1; i >= 1; --i) {
        for (j = 0; j < i ; ++j) {
            a[j] += a[j+1];
            a[j] %= 1000000007;
        }
    }
    cout << a[0] % 1000000007 << endl;
}
0