結果

問題 No.40 多項式の割り算
ユーザー msm1993
提出日時 2020-03-31 17:42:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 170,228 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 21:29:46
合計ジャッジ時間 2,692 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int n;cin>>n;
  vector<int> v(n+1);
  for(int i=0;i<=n;i++)cin>>v[i];
  reverse(v.begin(),v.end());
  for(int i=0;i<n-2;i++)v[i+2]+=v[i];
  reverse(v.begin(),v.end());
  if(v[2]){
    cout<<2<<endl;
    cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<endl;
  }
  else if(v[1]){
    cout<<1<<endl;
    cout<<v[0]<<" "<<v[1]<<endl;
  }
  else cout<<0<<endl<<v[0]<<endl;
}
0