結果
| 問題 |
No.3027 f-列とh-列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-21 21:40:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 998 bytes |
| コンパイル時間 | 2,099 ms |
| コンパイル使用メモリ | 199,012 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-21 21:40:36 |
| 合計ジャッジ時間 | 3,021 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> istream& operator >> (istream& is, vector<T>& vec) {
for(T& x : vec) is >> x;
return is;
}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
if(vec.empty()) return os;
os << vec[0];
for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
return os;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<vector<ll>> comb(30, vector<ll>(30));
comb[0][0] = 1;
for(int i = 1; i < 30; i++){
comb[i][0] = 1;
for(int j = 1; j <= i; j++){
comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
}
}
vector<ll> ans(n + 1);
for(int i = n; i >= 0; i--){
ll v;
cin >> v;
for(int j = i; j >= 0; j--){
ans[j] += (i % 2 == j % 2 ? v : -v) * comb[i][j];
}
}
reverse(ans.begin(), ans.end());
cout << ans << '\n';
}