結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-14 10:39:55 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 648 bytes |
| コンパイル時間 | 2,578 ms |
| コンパイル使用メモリ | 76,540 KB |
| 実行使用メモリ | 48,844 KB |
| 最終ジャッジ日時 | 2024-10-06 07:44:36 |
| 合計ジャッジ時間 | 11,164 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 RE * 1 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
int[] arr = new int[d + 1];
for (int i = 0; i <= d; i++) {
arr[i] = sc.nextInt();
}
for (int i = d; i >= 3; i--) {
int x = arr[i];
arr[i - 2] += x;
arr[i] = 0;
}
if (arr[2] != 0) {
System.out.println(2);
System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);
} else if (arr[1] != 0) {
System.out.println(1);
System.out.println(arr[0] + " " + arr[1]);
} else {
System.out.println(0);
System.out.println(arr[0]);
}
}
}
htensai