結果

問題 No.40 多項式の割り算
ユーザー mbanmban
提出日時 2016-12-28 18:42:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 1,494 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 111,244 KB
実行使用メモリ 28,216 KB
最終ジャッジ日時 2024-12-15 07:57:58
合計ジャッジ時間 2,955 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{

    static void Main()
    {
        int D = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        if (D == 0)
        {
            Console.WriteLine(0);
            Console.WriteLine(a[0]);
            return;
        }
        if (D ==1)
        {
            Console.WriteLine(1);
            Console.WriteLine("{0} {1}", a[0], a[1]);
            return;
        }
        if (D == 2)
        {
            Console.WriteLine(2);
            Console.WriteLine("{0} {1} {2}", a[0], a[1], a[2]);
            return;
        }
        for(int i = D; i >=3; i--)
        {
            a[i - 2] += a[i];
            a[i] = 0;
        }
        bool aa = false;
        string ans = "";
        int DD=0;
        int aaa = a[0];
        int bbb = a[1];
        int ccc = a[2];
        if (ccc == 0)
        {
            if (bbb == 0)
            {
                Console.WriteLine(0);
                Console.WriteLine(aaa);
            }
            else
            {
                Console.WriteLine(1);
                Console.WriteLine("{0} {1}", aaa, bbb);
            }
        }
        else
        {
            Console.WriteLine(2);
            Console.WriteLine("{0} {1} {2}", aaa, bbb, ccc);
        }
    }
}



0