結果

問題 No.40 多項式の割り算
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-06 23:20:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 238 ms / 5,000 ms
コード長 695 bytes
コンパイル時間 2,083 ms
コンパイル使用メモリ 71,712 KB
実行使用メモリ 59,960 KB
最終ジャッジ日時 2023-08-18 19:41:22
合計ジャッジ時間 9,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,524 KB
testcase_01 AC 124 ms
55,764 KB
testcase_02 AC 121 ms
56,188 KB
testcase_03 AC 123 ms
56,080 KB
testcase_04 AC 217 ms
59,928 KB
testcase_05 AC 223 ms
59,960 KB
testcase_06 AC 234 ms
57,544 KB
testcase_07 AC 235 ms
59,696 KB
testcase_08 AC 144 ms
55,728 KB
testcase_09 AC 205 ms
59,088 KB
testcase_10 AC 229 ms
58,796 KB
testcase_11 AC 205 ms
59,128 KB
testcase_12 AC 200 ms
58,492 KB
testcase_13 AC 238 ms
59,352 KB
testcase_14 AC 212 ms
58,948 KB
testcase_15 AC 211 ms
59,008 KB
testcase_16 AC 233 ms
58,856 KB
testcase_17 AC 198 ms
58,800 KB
testcase_18 AC 224 ms
59,172 KB
testcase_19 AC 231 ms
59,728 KB
testcase_20 AC 203 ms
58,824 KB
testcase_21 AC 186 ms
58,364 KB
testcase_22 AC 182 ms
58,348 KB
testcase_23 AC 200 ms
58,924 KB
testcase_24 AC 218 ms
59,084 KB
testcase_25 AC 118 ms
55,880 KB
testcase_26 AC 119 ms
55,760 KB
testcase_27 AC 119 ms
55,780 KB
testcase_28 AC 116 ms
55,972 KB
testcase_29 AC 121 ms
56,400 KB
testcase_30 AC 120 ms
56,068 KB
testcase_31 AC 119 ms
55,512 KB
testcase_32 AC 118 ms
55,840 KB
testcase_33 AC 122 ms
55,976 KB
testcase_34 AC 119 ms
56,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int D = sc.nextInt();
        int [] a = new int [D+1];
        for(int i=0; i<=D; i++){
            a[i] = sc.nextInt();
        }
        for(int i=D; i>=3; i--){
            a[i-2]+=a[i];
            a[i]=0;
        }
        int c=0;
        for(int i=D; i>=0; i--){
            if(a[i]!=0){
                c=i;
                break;
            }
        }
        System.out.println(c);
        for(int i=0; i<=c; i++){
            System.out.print(a[i]);
            if(i!=c){System.out.print(" ");}
        }
        System.out.println();
    }
}
0