結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
gu_21816943
|
| 提出日時 | 2017-06-28 21:57:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,228 bytes |
| コンパイル時間 | 1,874 ms |
| コンパイル使用メモリ | 80,304 KB |
| 実行使用メモリ | 52,636 KB |
| 最終ジャッジ日時 | 2024-10-04 14:58:50 |
| 合計ジャッジ時間 | 5,987 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 1 RE * 1 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
class Main {
static PrintWriter out = new PrintWriter(System.out);
static String str;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int d = Integer.parseInt(br.readLine());
String[] num = br.readLine().split(" ");
br.close();
int[] result = new int[d - 1];
PrintWriter out = new PrintWriter(System.out);
int i;
if (d < 3) {
out.println(d);
for (i = 0; i < d; i++) {
out.print(num[i] + " ");
}
out.println(num[i]);
} else {
int[] tmp = new int[d + 1];
for (i = 0; i < d + 1; i++) {
tmp[i] = Integer.parseInt(num[i]);
if (i < d - 1) {
result[i] = tmp[i];
}
}
result[d - 2] -= -tmp[d];
result[d - 3] -= -tmp[d - 1];
for (i = d-2; i >= 3; i--) {
result[i-2] -= -result[i];
result[i]=0;
}
int point = 0;
for (i = 0; i < d - 1; i++) {
if (result[i] != 0) {
point = i;
}
}
out.println(point);
for (i = 0; i < point; i++) {
out.print(result[i] + " ");
}
out.println(result[i]);
}
out.flush();
}
}
gu_21816943