結果

問題 No.40 多項式の割り算
ユーザー bluemeganebluemegane
提出日時 2021-04-23 13:08:11
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 993 ms
コンパイル使用メモリ 63,264 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2023-09-17 10:55:27
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,844 KB
testcase_01 AC 59 ms
20,744 KB
testcase_02 AC 60 ms
20,764 KB
testcase_03 AC 60 ms
18,816 KB
testcase_04 AC 69 ms
23,192 KB
testcase_05 AC 69 ms
21,268 KB
testcase_06 AC 69 ms
21,368 KB
testcase_07 AC 69 ms
21,404 KB
testcase_08 AC 67 ms
21,020 KB
testcase_09 AC 68 ms
21,096 KB
testcase_10 AC 69 ms
21,304 KB
testcase_11 AC 69 ms
23,212 KB
testcase_12 AC 69 ms
23,136 KB
testcase_13 AC 69 ms
21,336 KB
testcase_14 AC 69 ms
21,192 KB
testcase_15 AC 68 ms
21,300 KB
testcase_16 AC 69 ms
21,404 KB
testcase_17 AC 67 ms
21,192 KB
testcase_18 AC 69 ms
23,288 KB
testcase_19 AC 69 ms
23,424 KB
testcase_20 AC 68 ms
19,236 KB
testcase_21 AC 68 ms
23,028 KB
testcase_22 AC 68 ms
23,092 KB
testcase_23 AC 69 ms
21,160 KB
testcase_24 AC 69 ms
23,232 KB
testcase_25 AC 59 ms
20,740 KB
testcase_26 AC 60 ms
20,748 KB
testcase_27 AC 60 ms
20,776 KB
testcase_28 WA -
testcase_29 AC 59 ms
20,716 KB
testcase_30 AC 60 ms
20,768 KB
testcase_31 AC 60 ms
22,780 KB
testcase_32 AC 60 ms
22,792 KB
testcase_33 AC 59 ms
22,784 KB
testcase_34 AC 60 ms
22,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, a);
    }
    static void getAns(int n, int[] a)
    {
        n++;
        Array.Reverse(a);
        var t = new int[4];
        var imax = a.Length;
        if (imax > 4) imax = 4;
        for (int i = 0; i < imax ; i++) t[i] = a[i];
        if (imax <= 3) goto next;
        var b = new int[] { 1, 0, -1, 0 };
         imax = n - 3;
        var s = a[0];
        var p = 0;
        for (int i = 0; i < imax; i++)
        {
            for (int j = 1; j < 4; j++)
                t[j - 1] = t[j] - b[j] * s;
            if (4 + p < n) t[3] = a[4 + p];
            s = t[0];
            p++;
        }
    next:;
        if (t[0] == 0)
        {
            if (t[1] == 0) Console.WriteLine("0\n{0}", t[2]);
            else Console.WriteLine("1\n{0} {1}", t[2], t[1]);
        }
        else Console.WriteLine("2\n{0} {1} {2}", t[2], t[1], t[0]);
    }
}
0