結果

問題 No.40 多項式の割り算
ユーザー ldsybldsyb
提出日時 2017-06-21 20:21:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 953 ms
コンパイル使用メモリ 79,404 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 09:11:32
合計ジャッジ時間 2,283 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 16 ms
6,944 KB
testcase_05 AC 22 ms
6,940 KB
testcase_06 AC 27 ms
6,940 KB
testcase_07 AC 28 ms
6,944 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 19 ms
6,940 KB
testcase_10 AC 23 ms
6,944 KB
testcase_11 AC 14 ms
6,944 KB
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 25 ms
6,944 KB
testcase_14 AC 16 ms
6,940 KB
testcase_15 AC 15 ms
6,940 KB
testcase_16 AC 25 ms
6,940 KB
testcase_17 AC 8 ms
6,944 KB
testcase_18 AC 23 ms
6,944 KB
testcase_19 AC 25 ms
6,940 KB
testcase_20 AC 13 ms
6,944 KB
testcase_21 AC 7 ms
6,944 KB
testcase_22 AC 6 ms
6,940 KB
testcase_23 AC 13 ms
6,940 KB
testcase_24 AC 20 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 WA -
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

template <typename T>
string join(vector<T> v, string s = " "){
	stringstream ss;
	for(int i = 0; i < v.size(); i++){
		if(i) ss << s;
		ss << v[i];
	}
	return ss.str();
}

int main(){
	int d;
	cin >> d;
	d++;
	vector<int> a(d), v;
	for(int i = 0; i < d; i++) cin >> a[i];
	reverse(a.begin(), a.end());
	for(int i = 0; i < d - 3; i++) a[i + 2] += a[i];

	for(int i = 0; i < d; i++) cerr << a[i] << ' ';
		cerr << endl;

	bool f = false;
	for(int i = 0; i < 3; i++) if(f || a[d - 3 + i]){
		v.emplace_back(a[d - 3 + i]);
		f = true;
	}
	if(!f) v.emplace_back(0);
	reverse(v.begin(), v.end());
	cout << v.size() - 1 << endl;
	cout << join(v) << endl;
}
0