結果

問題 No.40 多項式の割り算
ユーザー ゴリポン先生ゴリポン先生
提出日時 2024-06-06 21:59:43
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 6,003 ms
コンパイル使用メモリ 211,840 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 16:33:40
合計ジャッジ時間 6,169 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

module main;

import std;

void main()
{
	// 入力
	auto N = readln.chomp.to!int;
	auto poly = readln.split.to!(long[]).reverse;
	// 答えの計算と出力
	while (poly.length >= 4) {
		poly[2] += poly[0];
		poly[0] = 0;
		while (poly.length > 1 && poly[0] == 0) poly.popFront;
	}
	writeln(poly.length - 1);
	writefln("%(%d %)", poly.reverse);
}
0