結果

問題 No.40 多項式の割り算
ユーザー fjafjafjafjafjafja
提出日時 2017-10-01 22:30:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 243 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 3,075 ms
コンパイル使用メモリ 79,244 KB
実行使用メモリ 58,872 KB
最終ジャッジ日時 2024-04-27 17:37:18
合計ジャッジ時間 10,535 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
53,860 KB
testcase_01 AC 124 ms
53,036 KB
testcase_02 AC 108 ms
54,040 KB
testcase_03 AC 121 ms
53,624 KB
testcase_04 AC 207 ms
57,716 KB
testcase_05 AC 225 ms
58,164 KB
testcase_06 AC 235 ms
58,872 KB
testcase_07 AC 226 ms
58,368 KB
testcase_08 AC 151 ms
54,104 KB
testcase_09 AC 213 ms
57,664 KB
testcase_10 AC 233 ms
58,524 KB
testcase_11 AC 218 ms
57,996 KB
testcase_12 AC 196 ms
57,076 KB
testcase_13 AC 239 ms
58,244 KB
testcase_14 AC 213 ms
57,592 KB
testcase_15 AC 213 ms
57,812 KB
testcase_16 AC 242 ms
58,380 KB
testcase_17 AC 190 ms
56,800 KB
testcase_18 AC 231 ms
58,132 KB
testcase_19 AC 234 ms
58,512 KB
testcase_20 AC 216 ms
57,844 KB
testcase_21 AC 188 ms
56,796 KB
testcase_22 AC 179 ms
56,828 KB
testcase_23 AC 212 ms
57,672 KB
testcase_24 AC 243 ms
58,116 KB
testcase_25 AC 141 ms
53,852 KB
testcase_26 AC 134 ms
54,112 KB
testcase_27 AC 118 ms
52,588 KB
testcase_28 AC 132 ms
54,192 KB
testcase_29 AC 115 ms
53,104 KB
testcase_30 AC 128 ms
53,656 KB
testcase_31 AC 121 ms
54,004 KB
testcase_32 AC 115 ms
52,756 KB
testcase_33 AC 124 ms
53,036 KB
testcase_34 AC 133 ms
54,048 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