結果

問題 No.40 多項式の割り算
ユーザー htensaihtensai
提出日時 2020-02-14 10:39:55
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 648 bytes
コンパイル時間 2,581 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 48,556 KB
最終ジャッジ日時 2024-04-16 00:09:56
合計ジャッジ時間 11,340 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
42,540 KB
testcase_01 AC 164 ms
42,684 KB
testcase_02 AC 128 ms
41,312 KB
testcase_03 AC 154 ms
42,116 KB
testcase_04 AC 270 ms
48,104 KB
testcase_05 AC 275 ms
47,760 KB
testcase_06 AC 292 ms
48,540 KB
testcase_07 AC 290 ms
48,516 KB
testcase_08 AC 182 ms
43,088 KB
testcase_09 AC 277 ms
47,832 KB
testcase_10 AC 286 ms
48,276 KB
testcase_11 AC 269 ms
47,300 KB
testcase_12 AC 254 ms
46,236 KB
testcase_13 AC 283 ms
48,556 KB
testcase_14 AC 270 ms
47,272 KB
testcase_15 AC 269 ms
47,084 KB
testcase_16 AC 295 ms
48,404 KB
testcase_17 AC 249 ms
44,828 KB
testcase_18 AC 292 ms
48,456 KB
testcase_19 AC 291 ms
48,300 KB
testcase_20 AC 265 ms
46,932 KB
testcase_21 AC 242 ms
45,180 KB
testcase_22 AC 230 ms
44,460 KB
testcase_23 AC 256 ms
46,556 KB
testcase_24 AC 276 ms
48,060 KB
testcase_25 AC 149 ms
42,676 KB
testcase_26 AC 163 ms
42,648 KB
testcase_27 AC 166 ms
42,772 KB
testcase_28 RE -
testcase_29 AC 156 ms
42,660 KB
testcase_30 AC 148 ms
42,256 KB
testcase_31 AC 168 ms
42,472 KB
testcase_32 AC 160 ms
42,664 KB
testcase_33 AC 158 ms
42,480 KB
testcase_34 AC 166 ms
42,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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]);
		}
   }
}
0