結果

問題 No.40 多項式の割り算
ユーザー soujikisoujiki
提出日時 2015-04-27 11:46:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 268 ms / 5,000 ms
コード長 793 bytes
コンパイル時間 4,421 ms
コンパイル使用メモリ 75,784 KB
実行使用メモリ 60,428 KB
最終ジャッジ日時 2023-09-18 13:47:25
合計ジャッジ時間 12,279 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
55,940 KB
testcase_01 AC 145 ms
55,924 KB
testcase_02 AC 156 ms
56,504 KB
testcase_03 AC 143 ms
55,932 KB
testcase_04 AC 245 ms
59,408 KB
testcase_05 AC 254 ms
59,376 KB
testcase_06 AC 267 ms
60,428 KB
testcase_07 AC 260 ms
59,848 KB
testcase_08 AC 166 ms
55,948 KB
testcase_09 AC 247 ms
59,424 KB
testcase_10 AC 258 ms
60,140 KB
testcase_11 AC 237 ms
59,744 KB
testcase_12 AC 222 ms
58,380 KB
testcase_13 AC 264 ms
60,096 KB
testcase_14 AC 241 ms
59,524 KB
testcase_15 AC 237 ms
59,256 KB
testcase_16 AC 268 ms
59,928 KB
testcase_17 AC 220 ms
58,796 KB
testcase_18 AC 256 ms
60,112 KB
testcase_19 AC 264 ms
60,260 KB
testcase_20 AC 238 ms
59,448 KB
testcase_21 AC 221 ms
58,784 KB
testcase_22 AC 214 ms
58,696 KB
testcase_23 AC 229 ms
59,660 KB
testcase_24 AC 249 ms
59,464 KB
testcase_25 AC 143 ms
55,648 KB
testcase_26 AC 142 ms
56,032 KB
testcase_27 AC 144 ms
55,744 KB
testcase_28 AC 126 ms
55,744 KB
testcase_29 AC 144 ms
55,516 KB
testcase_30 AC 148 ms
55,780 KB
testcase_31 AC 145 ms
55,788 KB
testcase_32 AC 147 ms
55,528 KB
testcase_33 AC 142 ms
56,032 KB
testcase_34 AC 143 ms
55,756 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=0;i<=D;i++){
				if(i==D){
					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