結果

問題 No.40 多項式の割り算
ユーザー maine_honzuki
提出日時 2020-05-06 22:58:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 499 bytes
コンパイル時間 1,694 ms
コンパイル使用メモリ 166,260 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 09:12:26
合計ジャッジ時間 3,008 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int D, a[10010];
    cin >> D;
    for (int i = 0; i <= D; i++) {
        cin >> a[i];
    }

    for (int i = D; i >= 3; i--) {
        a[i - 2] += a[i];
    }

    if (a[2]) {
        cout << 2 << endl
             << a[0] << " " << a[1] << " " << a[2] << endl;
    } else if (a[1]) {
        cout << 1 << endl
             << a[0] << " " << a[1] << endl;
    } else {
        cout << 0 << endl
             << a[0] << endl;
    }
}
0