結果
| 問題 | No.40 多項式の割り算 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-07-22 22:57:27 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 5,000 ms | 
| コード長 | 763 bytes | 
| コンパイル時間 | 3,024 ms | 
| コンパイル使用メモリ | 193,732 KB | 
| 最終ジャッジ日時 | 2025-01-12 03:30:20 | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> b(n+1);
  REP (i, n+1) cin >> b[i];
  int zero = b[0];
  int one = 0, none = 0;
  REP (i, n+1) {
    one += b[i];
    if (i % 2 == 0)
      none += b[i];
    else
      none -= b[i];
  }
  vector<int> ret(3);
  ret[0] = zero;
  ret[1] = (one - none) / 2;
  ret[2] = (one + none - 2 * zero) / 2;
  int d = 2;
  while (d > 0 && !ret[d]) {
    --d;
  }
  cout << d << endl;
  REP (i, d+1)
    cout << ret[i] << " ";
  cout << endl;
  return 0;
}
            
            
            
        