結果

問題 No.40 多項式の割り算
ユーザー soujikisoujiki
提出日時 2015-04-27 11:44:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 4,316 ms
コンパイル使用メモリ 85,344 KB
実行使用メモリ 60,768 KB
最終ジャッジ日時 2023-09-18 13:46:28
合計ジャッジ時間 12,294 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
55,760 KB
testcase_01 AC 140 ms
56,120 KB
testcase_02 AC 150 ms
56,584 KB
testcase_03 AC 138 ms
55,472 KB
testcase_04 AC 233 ms
59,292 KB
testcase_05 AC 245 ms
60,108 KB
testcase_06 AC 261 ms
60,660 KB
testcase_07 AC 257 ms
60,268 KB
testcase_08 AC 168 ms
55,904 KB
testcase_09 AC 242 ms
59,568 KB
testcase_10 AC 255 ms
60,108 KB
testcase_11 AC 231 ms
59,360 KB
testcase_12 AC 208 ms
58,816 KB
testcase_13 AC 251 ms
60,268 KB
testcase_14 AC 241 ms
59,540 KB
testcase_15 AC 236 ms
57,688 KB
testcase_16 AC 258 ms
60,252 KB
testcase_17 AC 216 ms
59,124 KB
testcase_18 AC 251 ms
59,964 KB
testcase_19 AC 255 ms
60,768 KB
testcase_20 AC 229 ms
59,388 KB
testcase_21 AC 215 ms
58,704 KB
testcase_22 AC 215 ms
59,116 KB
testcase_23 AC 229 ms
59,580 KB
testcase_24 AC 243 ms
59,704 KB
testcase_25 AC 139 ms
55,856 KB
testcase_26 AC 139 ms
55,756 KB
testcase_27 AC 141 ms
55,676 KB
testcase_28 AC 125 ms
55,936 KB
testcase_29 AC 140 ms
55,500 KB
testcase_30 AC 139 ms
55,728 KB
testcase_31 AC 141 ms
55,840 KB
testcase_32 WA -
testcase_33 AC 142 ms
55,972 KB
testcase_34 AC 140 ms
55,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		if(D<=2){
			System.out.println(D);
			for(int i=D;i>=0;i--){
				if(i==0){
					System.out.println(b[i]);
					break;
				}
				System.out.print(b[i]+" ");
			}
		}
		else{
			for(int i=D;i>=3;i--){
				b[i-2] = b[i-2] + b[i];
				b[i] = 0;
			}

			for(int i=2;i>=0;i--){
				if(b[i] != 0){
					System.out.println(i);
					for(int j=0;j<=i;j++){
						if(j==i){
							System.out.println(b[j]);
							break;
						}
						System.out.print(b[j]+" ");
					}
					break;
				}
				if(i==0){
					System.out.println(i+"\n"+i);
				}
			}
		}

	}
}
0