結果
問題 |
No.40 多項式の割り算
|
ユーザー |
![]() |
提出日時 | 2016-01-02 15:10:36 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 984 bytes |
コンパイル時間 | 975 ms |
コンパイル使用メモリ | 105,984 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-09-19 09:41:15 |
合計ジャッジ時間 | 3,070 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
using System; namespace yukicoder { class _040 { static void Main() { int d = int.Parse(Console.ReadLine()); int[] c = Array.ConvertAll(Console.ReadLine().Split(' ') , x => int.Parse(x)); for (int i = d; i >= 3; i--) { c[i - 2] += c[i]; } int od = 0; string b = ""; int m = Math.Min(2, c.Length - 1); for (int i = m; i >= 0; i--) { if (c[i] != 0) { if (od == 0) { od = i; } } if (od != 0 || c[i] != 0) { b = c[i] + " " + b; } } if (b == "") { b = "0"; } Console.WriteLine(od); Console.WriteLine(b); } } }