結果
問題 |
No.3027 f-列とh-列
|
ユーザー |
|
提出日時 | 2025-02-21 21:37:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 800 bytes |
コンパイル時間 | 2,061 ms |
コンパイル使用メモリ | 192,916 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-21 21:37:44 |
合計ジャッジ時間 | 2,957 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:45:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 45 | scanf("%d",&x); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; const ll LLINF=0x3f3f3f3f3f3f3f3fLL; const int MAX=2e5+10; ll comb[27][27]; void init_comb(int n,int m) { int i,j; comb[0][0]=1; for(i=1;i<=n;i++) { comb[i][0]=1; for(j=1;j<=i;j++) { comb[i][j]=comb[i-1][j]+comb[i-1][j-1]; } } } ll C(int n,int m) { if(m>n||m<0||n<0) return 0; return comb[n][m]; } ll res[27]; void gao(int x,int exp) { int i,now; now=1; for(i=exp;i>=0;i--) { res[i]+=x*C(exp,i)*now; now*=-1; } } int main() { int n,i,x; init_comb(25,25); scanf("%d",&n); memset(res,0,sizeof res); for(i=0;i<=n;i++) { scanf("%d",&x); if(i==n) res[n-i]+=x; else gao(x,n-i); } reverse(res,res+n+1); for(i=0;i<=n;i++) printf("%lld%c",res[i]," \n"[i==n]); return 0; }