結果
問題 |
No.3027 f-列とh-列
|
ユーザー |
|
提出日時 | 2025-02-21 23:34:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 1,830 ms |
コンパイル使用メモリ | 164,740 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-21 23:34:47 |
合計ジャッジ時間 | 2,572 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘void combi()’: main.cpp:17:32: warning: iteration 30 invokes undefined behavior [-Waggressive-loop-optimizations] 17 | C[n][0]=C[n][n]=1; | ~~~~~~~^~ main.cpp:16:21: note: within this loop 16 | for(ll n=0;n<=30;n++){ | ~^~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef pair<P,ll> Q; #define REP(i,n) for(ll i=0;i<ll(n);i++) ll C[30][30]; void combi(){ for(ll n=0;n<=30;n++){ C[n][0]=C[n][n]=1; for(ll k=1;k<n;k++){ C[n][k]=C[n-1][k-1]+C[n-1][k]; } } } int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j; ll N; cin >> N; vector<ll> v(N+1); REP(i,N+1) cin >> v[i]; combi(); REP(i,N+1){ for(j=1;j<=N;j++){ if(j%2==1) C[i][j]*=-1; } } for(i=1;i<=N;i++){ for(j=0;j<=N;j++){ C[i][j]*=v[N-i]; } } C[0][0]=v[N]; for(i=N;i>=0;i--){ ll s=0; for(j=i;j<=N;j++){ s+=C[j][j-i]; } cout << s << ' '; } cout << endl; return 0; }