結果

問題 No.40 多項式の割り算
ユーザー htensaihtensai
提出日時 2020-02-14 10:41:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 313 ms / 5,000 ms
コード長 668 bytes
コンパイル時間 2,408 ms
コンパイル使用メモリ 76,976 KB
実行使用メモリ 48,756 KB
最終ジャッジ日時 2024-04-16 00:10:11
合計ジャッジ時間 12,444 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
42,744 KB
testcase_01 AC 176 ms
42,508 KB
testcase_02 AC 140 ms
41,412 KB
testcase_03 AC 163 ms
42,252 KB
testcase_04 AC 281 ms
47,608 KB
testcase_05 AC 294 ms
47,964 KB
testcase_06 AC 313 ms
48,208 KB
testcase_07 AC 309 ms
48,628 KB
testcase_08 AC 200 ms
43,372 KB
testcase_09 AC 290 ms
48,400 KB
testcase_10 AC 307 ms
48,756 KB
testcase_11 AC 284 ms
47,204 KB
testcase_12 AC 271 ms
46,024 KB
testcase_13 AC 303 ms
48,648 KB
testcase_14 AC 287 ms
47,528 KB
testcase_15 AC 282 ms
47,260 KB
testcase_16 AC 306 ms
48,716 KB
testcase_17 AC 255 ms
45,136 KB
testcase_18 AC 304 ms
48,460 KB
testcase_19 AC 308 ms
48,696 KB
testcase_20 AC 276 ms
47,004 KB
testcase_21 AC 250 ms
45,260 KB
testcase_22 AC 245 ms
45,832 KB
testcase_23 AC 279 ms
47,116 KB
testcase_24 AC 292 ms
47,944 KB
testcase_25 AC 177 ms
42,528 KB
testcase_26 AC 176 ms
42,448 KB
testcase_27 AC 177 ms
42,524 KB
testcase_28 AC 137 ms
41,392 KB
testcase_29 AC 175 ms
42,316 KB
testcase_30 AC 175 ms
42,612 KB
testcase_31 AC 176 ms
42,732 KB
testcase_32 AC 179 ms
42,592 KB
testcase_33 AC 175 ms
42,484 KB
testcase_34 AC 174 ms
42,632 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 (d >= 2 && arr[2] != 0) {
		    System.out.println(2);
		    System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);
		} else if (d >= 1 && 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