結果
| 問題 | No.40 多項式の割り算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-16 21:56:13 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 424 ms / 5,000 ms |
| コード長 | 566 bytes |
| 記録 | |
| コンパイル時間 | 275 ms |
| コンパイル使用メモリ | 77,356 KB |
| 最終ジャッジ日時 | 2025-12-03 12:59:33 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#!/usr/bin/python
def sub(a,b):
m=max(len(a),len(b))
return [(0 if len(a)<=i else a[i])+(0 if len(b)<=i else -b[i]) for i in range(m)]
def checkio(exp,div):
c=[]
while len(div)<=len(exp):
d=exp[-1]//div[-1]
c.append(d)
exp=sub(exp,[0]*(len(exp)-len(div))+[e*d for e in div])
#assert exp[-1]==0
exp.pop()
while len(exp)>1 and exp[-1]==0: exp.pop()
print(len(exp)-1)
print(' '.join(str(e) for e in exp))
import sys
if sys.version_info[0]>=3: raw_input=input
raw_input()
checkio([int(e) for e in raw_input().split()],[0,-1,0,1])