結果

問題 No.40 多項式の割り算
ユーザー bluemeganebluemegane
提出日時 2021-04-23 07:51:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 787 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 67,152 KB
実行使用メモリ 16,624 KB
最終ジャッジ日時 2023-09-17 10:47:41
合計ジャッジ時間 5,294 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
15,580 KB
testcase_01 AC 60 ms
15,512 KB
testcase_02 AC 60 ms
15,604 KB
testcase_03 AC 60 ms
15,588 KB
testcase_04 AC 70 ms
16,316 KB
testcase_05 AC 73 ms
16,188 KB
testcase_06 AC 70 ms
16,624 KB
testcase_07 AC 72 ms
16,436 KB
testcase_08 AC 68 ms
15,596 KB
testcase_09 AC 69 ms
16,416 KB
testcase_10 AC 69 ms
16,492 KB
testcase_11 AC 70 ms
16,276 KB
testcase_12 AC 70 ms
16,096 KB
testcase_13 AC 70 ms
16,600 KB
testcase_14 AC 70 ms
16,256 KB
testcase_15 AC 70 ms
16,224 KB
testcase_16 AC 71 ms
16,440 KB
testcase_17 AC 69 ms
16,160 KB
testcase_18 AC 70 ms
16,508 KB
testcase_19 AC 71 ms
16,524 KB
testcase_20 AC 71 ms
16,308 KB
testcase_21 AC 69 ms
16,000 KB
testcase_22 AC 68 ms
15,928 KB
testcase_23 AC 70 ms
16,192 KB
testcase_24 AC 69 ms
16,328 KB
testcase_25 AC 61 ms
15,452 KB
testcase_26 AC 62 ms
15,580 KB
testcase_27 AC 61 ms
15,392 KB
testcase_28 AC 60 ms
15,464 KB
testcase_29 AC 60 ms
15,636 KB
testcase_30 AC 61 ms
15,452 KB
testcase_31 AC 61 ms
15,640 KB
testcase_32 AC 62 ms
15,528 KB
testcase_33 AC 62 ms
15,536 KB
testcase_34 AC 61 ms
15,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Linq;
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)
    {
        var c = a[0];
        var gp1 = a.Sum();
        var gp2 = c;
        for (int i = 1; i <= n; i++)
            gp2 += i % 2 == 0 ? a[i] : -a[i];
        var ans2 = (gp1 + gp2) / 2 - c;
        var ans1 = (gp1 - gp2) / 2;
        if (ans2 == 0)
        {
            if (ans1 == 0) Console.WriteLine("0\n{0}", c);
            else Console.WriteLine("1\n{0} {1}", c, ans1);
        }
        else Console.WriteLine("2\n{0} {1} {2}", c, ans1, ans2);
    }
}
0