結果

問題 No.40 多項式の割り算
ユーザー rn4ru
提出日時 2016-04-14 06:04:52
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 550 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 76,204 KB
実行使用メモリ 58,512 KB
最終ジャッジ日時 2024-10-04 08:18:10
合計ジャッジ時間 10,045 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int D = scanner.nextInt();
		int[] a = new int[D + 1];
		for (int i = 0; i < D + 1; i++) {
			a[i] = scanner.nextInt();
		}

		for (int i = D; i >= 3; i--) {
			a[i - 2] += a[i];
			a[i] = 0;
		}

		int ans = 0;
		if (a[2] != 0) {
			ans = 2;
		} else if (a[1] != 0) {
			ans = 1;
		}
		System.out.println(ans);
		for (int i = 0; i <= ans; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println();
	}

}
0