結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-31 09:02:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 820 bytes |
| コンパイル時間 | 551 ms |
| コンパイル使用メモリ | 72,064 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-17 22:52:57 |
| 合計ジャッジ時間 | 1,749 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 11 |
コンパイルメッセージ
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;
}
goodbaton