結果

問題 No.40 多項式の割り算
ユーザー hotpepsi
提出日時 2015-06-18 01:23:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 656 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 63,512 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 03:36:53
合計ジャッジ時間 1,604 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	getline(cin, s);
	stringstream sa(s);
	int D;
	sa >> D;
	getline(cin, s);
	stringstream sb(s);
	int b[10002] = {};
	for (int i = 0; i <= D; ++i) {
		sb >> b[i];
	}
	for (int i = D; i >= 3; --i) {
		b[i - 2] += b[i];
	}
	for (D = 2; D > 0 && !b[D]; --D) {
		;
	}
	if (b[2]) {
		cout << 2 << endl;
		cout << b[0] << " " << b[1] << " " << b[2] << endl;
	} else if (b[1]) {
		cout << 1 << endl;
		cout << b[0] << " " << b[1] << endl;
	} else {
		cout << 0 << endl;
		cout << b[0] << " " << endl;
	}
	return 0;
}
0