結果

問題 No.40 多項式の割り算
ユーザー tyochiaityochiai
提出日時 2015-02-09 03:39:31
言語 Go
(1.22.1)
結果
RE  
実行時間 -
コード長 445 bytes
コンパイル時間 12,069 ms
コンパイル使用メモリ 223,432 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 10:08:38
合計ジャッジ時間 11,728 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 20 ms
5,376 KB
testcase_05 AC 26 ms
5,376 KB
testcase_06 AC 35 ms
5,376 KB
testcase_07 AC 35 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 25 ms
5,376 KB
testcase_10 AC 31 ms
5,376 KB
testcase_11 AC 19 ms
5,376 KB
testcase_12 AC 13 ms
5,376 KB
testcase_13 AC 32 ms
5,376 KB
testcase_14 AC 21 ms
5,376 KB
testcase_15 AC 21 ms
5,376 KB
testcase_16 AC 31 ms
5,376 KB
testcase_17 AC 10 ms
5,376 KB
testcase_18 AC 30 ms
5,376 KB
testcase_19 AC 36 ms
5,376 KB
testcase_20 AC 17 ms
5,376 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 7 ms
5,376 KB
testcase_23 AC 17 ms
5,376 KB
testcase_24 AC 26 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 RE -
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func resolve(D int, a []int) {
	for i := D; i >= 3; i-- {
		a[i-2] += a[i]
	}
	d := 2
	for d != 0 && a[d] == 0 {
		d -= 1
	}

	fmt.Println(d)
	for i := 0; i < d+1; i++ {
		fmt.Printf("%d", a[i])
		if i != d {
			fmt.Printf(" ")
		} else {
			fmt.Println("")
		}
	}
}

func main() {
	var D int
	fmt.Scanf("%d\n", &D)
	a := make([]int, D+1)
	for i := 0; i < D+1; i++ {
		fmt.Scanf("%d", &a[i])
	}
	resolve(D, a)
}
0