結果

問題 No.40 多項式の割り算
コンテスト
ユーザー misora192
提出日時 2020-06-13 22:00:31
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 704 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,092 ms
コンパイル使用メモリ 183,024 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-12 10:22:46
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll d;
	cin >> d;

	vector<ll> a(d+1);
	rep(i, d+1) cin >> a[i];

	for(int i = d - 2; i >= 1; i--){
		a[i] += a[i+2];
	}

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