結果

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

ソースコード

diff #

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

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

    for(int i = N-1; i >= 3; i--) n[i-2] += n[i], n[i] = 0;

    int i = 2;
    while(n[i] == 0) i--;

    cout << i << endl;
    REP(j,i) cout << n[j] << " "; cout << n[i] << endl;
}
0