結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2017-06-21 20:21:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 750 bytes |
| コンパイル時間 | 1,017 ms |
| コンパイル使用メモリ | 79,012 KB |
| 実行使用メモリ | 6,940 KB |
| 最終ジャッジ日時 | 2024-10-02 10:58:49 |
| 合計ジャッジ時間 | 2,659 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 1 |
ソースコード
#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;
}
ldsyb