結果

問題 No.40 多項式の割り算
ユーザー fjafjafjafjafjafja
提出日時 2017-10-01 22:30:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 268 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 3,547 ms
コンパイル使用メモリ 75,880 KB
実行使用メモリ 60,424 KB
最終ジャッジ日時 2023-08-09 23:25:48
合計ジャッジ時間 12,574 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
55,912 KB
testcase_01 AC 142 ms
55,676 KB
testcase_02 AC 128 ms
55,660 KB
testcase_03 AC 142 ms
53,380 KB
testcase_04 AC 239 ms
59,268 KB
testcase_05 AC 252 ms
59,336 KB
testcase_06 AC 265 ms
60,388 KB
testcase_07 AC 268 ms
60,092 KB
testcase_08 AC 171 ms
56,104 KB
testcase_09 AC 250 ms
59,884 KB
testcase_10 AC 259 ms
59,760 KB
testcase_11 AC 243 ms
59,060 KB
testcase_12 AC 228 ms
59,108 KB
testcase_13 AC 262 ms
60,424 KB
testcase_14 AC 246 ms
59,952 KB
testcase_15 AC 239 ms
59,724 KB
testcase_16 AC 262 ms
60,144 KB
testcase_17 AC 225 ms
58,476 KB
testcase_18 AC 257 ms
59,796 KB
testcase_19 AC 261 ms
59,560 KB
testcase_20 AC 242 ms
59,680 KB
testcase_21 AC 224 ms
58,500 KB
testcase_22 AC 221 ms
58,772 KB
testcase_23 AC 239 ms
59,548 KB
testcase_24 AC 254 ms
60,044 KB
testcase_25 AC 142 ms
55,764 KB
testcase_26 AC 143 ms
55,676 KB
testcase_27 AC 142 ms
55,624 KB
testcase_28 AC 142 ms
56,112 KB
testcase_29 AC 143 ms
55,736 KB
testcase_30 AC 143 ms
55,660 KB
testcase_31 AC 146 ms
55,428 KB
testcase_32 AC 143 ms
55,892 KB
testcase_33 AC 142 ms
55,624 KB
testcase_34 AC 141 ms
55,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N40 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d=sc.nextInt();
		int[] a=new int[d+1];
		int dd=-1;
		int[] b=new int[3];
		int[] buf=new int[d+1];
		for(int i=d;i>=0;i--){
			buf[i]=sc.nextInt();
		}
		for(int i=0;i<=d;i++){
			a[i]+=buf[i];
			if(i<d-2){
				a[i+2]+=a[i];
				a[i]=0;
			}
		}
		int ind=0;
		for(int i=0;i<=d;i++){
			if(dd==-1&&a[i]!=0){
				dd=d-i;
				ind=i;
			}
		}
		if(dd==-1){
			System.out.println(0+"\n"+0);
		}
		else{
			System.out.println(dd);
			for(int i=d;i>=ind;i--){
				System.out.print(a[i]+" ");
			}
		}
	}
}
0