結果

問題 No.40 多項式の割り算
ユーザー shimashima_k
提出日時 2015-04-26 16:22:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 60,144 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-05 02:49:36
合計ジャッジ時間 1,382 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include "iostream"
using namespace std;

int main() {
    int d,e;
    vector<int> m;
    cin >> d;

    for (int i=0; i <= d; i++) {
        cin >> e;
        m.push_back(e);
    }


    while (d>2){

        if(m[d]!=0){
            m[d-2] += m[d];
        }
        d--;
    }



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

    return 0;
}
0