結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-03-29 00:18:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 449 bytes |
| コンパイル時間 | 359 ms |
| コンパイル使用メモリ | 51,784 KB |
| 最終ジャッジ日時 | 2024-11-14 19:01:02 |
| 合計ジャッジ時間 | 730 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:9: error: ‘vector’ was not declared in this scope
8 | vector<int> a(n+1);
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:8:16: error: expected primary-expression before ‘int’
8 | vector<int> a(n+1);
| ^~~
main.cpp:9:21: error: ‘a’ was not declared in this scope
9 | for(int& v: a) cin>>v;
| ^
main.cpp:10:23: error: ‘a’ was not declared in this scope
10 | reverse(begin(a), end(a));
| ^
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
while (cin>>n) {
vector<int> a(n+1);
for(int& v: a) cin>>v;
reverse(begin(a), end(a));
for(int i=0;i+2<n;++i) {
a[i+2]+=a[i];
a[i]=0;
}
int k=0;
while (k<n and a[k]==0) ++k;
cout<<n-k<<'\n';
for(int i=n;i+1>k;--i) cout<<a[i]<<' ';
cout<<endl;
}
}
hogeover30