結果

問題 No.3027 f-列とh-列
ユーザー GOTKAKO
提出日時 2025-02-21 21:25:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 2,243 ms
コンパイル使用メモリ 195,188 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-21 21:26:13
合計ジャッジ時間 3,268 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
void Yes(){cout << "YES\n";}
void No(){cout << "NO\n";}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N; N++;
    auto nCr = [&](int n,int r) -> long long {
        if(n < 0 || r < 0 || n < r) return 0;
        long long ret = 1;
        for(int i=1; i<=r; i++) ret *= n--,ret /= i;
        return ret;
    };
    vector<long long> F(N);
    for(auto &a : F) cin >> a;

    N--;
    for(int i=0; i<=N; i++){
        if(i) cout << " ";
        long long answer = 0;
        for(int k=0; k<=i; k++){
            if((i-k)%2 == 0) answer += nCr(N-k,i-k)*F.at(k);
            else answer -= nCr(N-k,i-k)*F.at(k);
        }
        cout << answer;
    }
    cout << endl;
}
0