結果

問題 No.40 多項式の割り算
ユーザー soujikisoujiki
提出日時 2015-04-27 11:42:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 781 bytes
コンパイル時間 3,595 ms
コンパイル使用メモリ 76,156 KB
実行使用メモリ 60,376 KB
最終ジャッジ日時 2023-09-18 13:45:43
合計ジャッジ時間 12,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 144 ms
55,524 KB
testcase_02 AC 156 ms
56,848 KB
testcase_03 AC 145 ms
55,620 KB
testcase_04 AC 242 ms
59,696 KB
testcase_05 AC 256 ms
59,672 KB
testcase_06 AC 264 ms
59,968 KB
testcase_07 AC 268 ms
59,872 KB
testcase_08 AC 174 ms
55,784 KB
testcase_09 AC 252 ms
60,064 KB
testcase_10 AC 259 ms
60,368 KB
testcase_11 AC 243 ms
59,548 KB
testcase_12 AC 227 ms
59,312 KB
testcase_13 AC 258 ms
60,260 KB
testcase_14 AC 241 ms
59,456 KB
testcase_15 AC 244 ms
59,708 KB
testcase_16 AC 263 ms
60,160 KB
testcase_17 AC 224 ms
58,624 KB
testcase_18 AC 264 ms
60,140 KB
testcase_19 AC 273 ms
60,376 KB
testcase_20 AC 224 ms
57,408 KB
testcase_21 AC 221 ms
58,876 KB
testcase_22 AC 219 ms
58,952 KB
testcase_23 AC 239 ms
59,656 KB
testcase_24 AC 257 ms
59,348 KB
testcase_25 AC 148 ms
55,812 KB
testcase_26 AC 145 ms
55,672 KB
testcase_27 AC 144 ms
55,708 KB
testcase_28 WA -
testcase_29 AC 145 ms
56,132 KB
testcase_30 AC 146 ms
55,716 KB
testcase_31 AC 144 ms
55,768 KB
testcase_32 WA -
testcase_33 AC 145 ms
53,440 KB
testcase_34 AC 144 ms
55,836 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]);
				}
				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