結果
問題 |
No.265 数学のテスト
|
ユーザー |
|
提出日時 | 2015-08-09 03:05:41 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 28,928 KB |
最終ジャッジ日時 | 2024-07-18 06:09:49 |
合計ジャッジ時間 | 5,566 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 RE * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
#!/usr/bin/ruby class Array def -@ self.map(&:-@) end def +(other) m=[self.size,other.size].max m.times.map{|i|(self.size<=i ? 0 : self[i])+(other.size<=i ? 0 : other[i])} end def -(other) self+-other end def *(other) r=[] other.size.times{|i| r=r+i.times.map{0}.concat(self.map{|e|other[i]*e}) } r end end def d(a) a.size<=1 ? [0] : 1.step(a.size-1).map{|i|i*a[i]} end gets D=gets.to_i S=gets.chomp.gsub(/(\d+)/,'[\1]').gsub('x','[0,1]').gsub('d{','d(').gsub('}',')') A=eval S puts A.concat((D+1-A.size).times.map{0}).join(' ')