結果
| 問題 | No.40 多項式の割り算 |
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2017-06-21 20:24:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 782 bytes |
| 記録 | |
| コンパイル時間 | 883 ms |
| コンパイル使用メモリ | 80,060 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-02 10:59:19 |
| 合計ジャッジ時間 | 2,278 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 3 WA * 29 |
ソースコード
#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 < min(0, 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 < min(d, 3); i++) if(f || a[d - min(d, 3) + i]){
v.emplace_back(a[d - min(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;
}
ldsyb