結果
| 問題 | No.40 多項式の割り算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-10 11:51:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 620 ms |
| コンパイル使用メモリ | 71,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-20 21:45:09 |
| 合計ジャッジ時間 | 1,840 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int d;cin>>d;
vector<int> a(d+1);
for(int i = 0; d >= i; i++){
cin>>a[i];
}
reverse(a.begin(),a.end());
for(int i = 0; d-2 > i; i++){
a[i+2]+=a[i];
a[i] = 0;
}
int st = d;
for(int i = 0; d >= i; i++){
if(a[i]){
st = min(st,i);
}
}
cout << d-st << endl;
for(int i = d; st <= i; i--){
cout << a[i];
if(i != st)cout << " ";
}
cout << endl;
}