結果

問題 No.40 多項式の割り算
ユーザー ぴろずぴろず
提出日時 2014-12-21 12:29:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 72,324 KB
実行使用メモリ 61,792 KB
最終ジャッジ日時 2023-09-02 20:43:37
合計ジャッジ時間 10,638 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,252 KB
testcase_01 AC 128 ms
55,596 KB
testcase_02 AC 130 ms
55,292 KB
testcase_03 AC 128 ms
55,324 KB
testcase_04 AC 217 ms
58,996 KB
testcase_05 WA -
testcase_06 AC 234 ms
59,480 KB
testcase_07 AC 237 ms
59,472 KB
testcase_08 AC 149 ms
55,816 KB
testcase_09 AC 216 ms
59,524 KB
testcase_10 AC 231 ms
59,332 KB
testcase_11 AC 210 ms
61,052 KB
testcase_12 WA -
testcase_13 AC 228 ms
59,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 241 ms
59,400 KB
testcase_17 AC 197 ms
58,388 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 196 ms
58,292 KB
testcase_22 AC 190 ms
56,360 KB
testcase_23 AC 207 ms
59,644 KB
testcase_24 WA -
testcase_25 AC 123 ms
55,476 KB
testcase_26 AC 122 ms
55,324 KB
testcase_27 WA -
testcase_28 AC 122 ms
55,812 KB
testcase_29 AC 123 ms
55,480 KB
testcase_30 AC 122 ms
55,488 KB
testcase_31 AC 122 ms
55,352 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 122 ms
55,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no040;

import java.util.Scanner;

public class Main {

	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=0;i<=d-3;i++) {
			a[d-i-2] += a[d-i];
			a[d-i] = 0;
		}
		int d_ = 0;
		for(int i=0;i<=d;i++) {
			if (a[i] > 0) {
				d_ = i;
			}
		}
		System.out.println(d_);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<=d_;i++) {
			if (i > 0) {
				sb.append(' ');
			}
			sb.append(a[i]);
		}
		System.out.println(sb.toString());
	}

}
0