結果

問題 No.40 多項式の割り算
ユーザー むらため
提出日時 2017-08-13 09:51:01
言語 Nim
(2.2.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 3,331 ms
コンパイル使用メモリ 68,224 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 02:29:22
合計ジャッジ時間 4,379 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 50) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]
/home/judge/data/code/Main.nim(1, 50) Warning: imported and not used: 'future' [UnusedImport]
/home/judge/data/code/Main.nim(1, 57) Warning: imported and not used: 'macros' [UnusedImport]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'strscans' [UnusedImport]
/home/judge/data/code/Main.nim(1, 35) Warning: imported and not used: 'algorithm' [UnusedImport]
/home/judge/data/code/Main.nim(1, 45) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,strscans,algorithm,math,future,macros
template get*():string = stdin.readLine() #.strip()

let
  D = get().parseInt()
  A = get().split().map(parseInt)
var ans = A
for i in countdown(D, 3):
  ans[i-2] += ans[i]
  ans[i] = 0

if ans.len >= 3 and ans[2] != 0:
  echo 2
  echo ans[0..2].mapIt($it).join(" ")
elif ans.len >= 2 and ans[1] != 0:
  echo 1
  echo ans[0..1].mapIt($it).join(" ")
else:
  echo 0
  echo ans[0]
0