結果

問題 No.40 多項式の割り算
ユーザー なお
提出日時 2014-10-15 00:05:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 671 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 57,176 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 09:11:17
合計ジャッジ時間 2,142 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
#define FOR(i, f, t)        for(int(i)=(f);(i)<(t);(++i))

int n[10010];

int main(){
    int N;
    cin >> N; N++;
    REP(i,N) cin >> n[i];
    reverse(n,n+N);

    REP(i,N-3){
        n[i+2] += n[i]; n[i] = 0;
    }
    //REP(i,N) cerr << n[i] << " "; cerr << endl;

    FOR(i,N-3,N){
        if(n[i] || i == N-1){
            cout << N-i-1 << endl << n[N-1];
            for(int j = N-2; j >= i; j--) cout << " " << n[j];
            cout << endl;
            break;
        }
    }
    return 0;
}

0