結果

問題 No.40 多項式の割り算
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-03 05:53:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 264 ms / 5,000 ms
コード長 1,140 bytes
コンパイル時間 3,569 ms
コンパイル使用メモリ 77,728 KB
実行使用メモリ 60,552 KB
最終ジャッジ日時 2023-09-17 03:55:47
合計ジャッジ時間 12,373 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
56,244 KB
testcase_01 AC 138 ms
56,232 KB
testcase_02 AC 127 ms
55,384 KB
testcase_03 AC 140 ms
56,220 KB
testcase_04 AC 238 ms
59,496 KB
testcase_05 AC 245 ms
60,268 KB
testcase_06 AC 264 ms
60,224 KB
testcase_07 AC 263 ms
59,868 KB
testcase_08 AC 166 ms
56,020 KB
testcase_09 AC 242 ms
59,744 KB
testcase_10 AC 258 ms
59,896 KB
testcase_11 AC 240 ms
59,324 KB
testcase_12 AC 222 ms
58,600 KB
testcase_13 AC 260 ms
60,368 KB
testcase_14 AC 240 ms
59,460 KB
testcase_15 AC 241 ms
59,920 KB
testcase_16 AC 254 ms
60,552 KB
testcase_17 AC 215 ms
59,268 KB
testcase_18 AC 253 ms
59,528 KB
testcase_19 AC 260 ms
60,200 KB
testcase_20 AC 232 ms
59,640 KB
testcase_21 AC 212 ms
59,224 KB
testcase_22 AC 213 ms
59,388 KB
testcase_23 AC 232 ms
59,840 KB
testcase_24 AC 249 ms
60,488 KB
testcase_25 AC 140 ms
55,868 KB
testcase_26 AC 140 ms
55,736 KB
testcase_27 AC 139 ms
55,864 KB
testcase_28 AC 123 ms
56,236 KB
testcase_29 AC 138 ms
54,152 KB
testcase_30 AC 137 ms
56,372 KB
testcase_31 AC 137 ms
55,844 KB
testcase_32 AC 135 ms
56,452 KB
testcase_33 AC 138 ms
56,300 KB
testcase_34 AC 140 ms
55,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.40 多項式の割り算

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No40 {
    
    static final Scanner sc = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        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 dim = 0;
        for (int i=0; i<min(3,d+1); i++) {
            if (a[i] != 0) dim = i;
        }
        out.println(dim);
        for (int i=0; i<=dim; i++) {
            if (i != dim) out.print(a[i]+" ");
            else out.println(a[i]);
        }
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        sc.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0