結果

問題 No.40 多項式の割り算
ユーザー Grenache
提出日時 2015-11-03 16:44:14
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 769 bytes
コンパイル時間 3,352 ms
コンパイル使用メモリ 74,572 KB
実行使用メモリ 58,264 KB
最終ジャッジ日時 2024-09-13 12:09:38
合計ジャッジ時間 11,511 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder40 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int d = sc.nextInt();
        int[] a = new int[d + 1];
        for (int i = 0; i <= d; i++) {
        	a[i] = sc.nextInt();
        }
        
        for (int i = d; i >= 3; i--) {
        	a[i - 2] -= -a[i];
        	a[i] = 0;
        }

        if (a[2] != 0) {
        	System.out.println("2");
        	System.out.printf("%d %d %d\n", a[0], a[1], a[2]);
        } else if (a[1] != 0) {
        	System.out.println("1");
        	System.out.printf("%d %d\n", a[0], a[1]);
        } else {
        	System.out.println("0");
        	System.out.printf("%d\n", a[0]);
        }

        sc.close();
    }
}
0