結果
問題 | No.40 多項式の割り算 |
ユーザー |
![]() |
提出日時 | 2015-07-31 09:05:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 691 ms |
コンパイル使用メモリ | 72,180 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-17 22:53:00 |
合計ジャッジ時間 | 1,516 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d",&d); | ~~~~~^~~~~~~~~ main.cpp:28:32: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | for(int i=0;i<=d;i++) scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <cstring> typedef long long ll; using namespace std; #define mod 1000000009 #define INF 10000000 #define LLINF 2000000000000000000LL #define SIZE 10001 int main(){ int d,d_,a[SIZE]; scanf("%d",&d); for(int i=0;i<=d;i++) scanf("%d",&a[i]); for(int i=d;i>=3;i--){ a[i-2]+=a[i]; a[i]=0; } for(d_=d;d_>=0;d_--){ if(a[d_]!=0){ break; } } if(d_==-1) d_=0; printf("%d\n",d_); for(int i=0;i<=d_;i++){ printf(i==d_ ?"%d\n":"%d ",a[i]); } return 0; }