結果

問題 No.265 数学のテスト
ユーザー cielciel
提出日時 2015-08-09 03:23:42
言語 Ruby
(3.2.2)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 11,360 KB
実行使用メモリ 31,768 KB
最終ジャッジ日時 2023-08-16 02:05:00
合計ジャッジ時間 6,677 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,508 KB
testcase_01 AC 75 ms
15,628 KB
testcase_02 AC 248 ms
31,768 KB
testcase_03 AC 163 ms
24,208 KB
testcase_04 AC 174 ms
24,740 KB
testcase_05 AC 196 ms
26,452 KB
testcase_06 AC 161 ms
24,388 KB
testcase_07 AC 181 ms
26,168 KB
testcase_08 AC 218 ms
28,892 KB
testcase_09 AC 160 ms
23,536 KB
testcase_10 AC 168 ms
24,268 KB
testcase_11 AC 185 ms
25,696 KB
testcase_12 AC 72 ms
15,076 KB
testcase_13 AC 86 ms
18,012 KB
testcase_14 AC 90 ms
17,340 KB
testcase_15 AC 68 ms
15,260 KB
testcase_16 AC 84 ms
16,804 KB
testcase_17 AC 68 ms
15,252 KB
testcase_18 AC 69 ms
15,168 KB
testcase_19 AC 71 ms
15,036 KB
testcase_20 AC 75 ms
15,576 KB
testcase_21 AC 71 ms
15,236 KB
testcase_22 AC 97 ms
17,496 KB
testcase_23 AC 70 ms
15,292 KB
testcase_24 AC 73 ms
15,144 KB
testcase_25 AC 124 ms
20,028 KB
testcase_26 AC 70 ms
15,152 KB
testcase_27 AC 71 ms
15,128 KB
testcase_28 AC 75 ms
16,004 KB
testcase_29 AC 69 ms
15,256 KB
testcase_30 AC 71 ms
15,820 KB
testcase_31 AC 68 ms
15,172 KB
testcase_32 AC 71 ms
15,040 KB
testcase_33 AC 73 ms
15,160 KB
testcase_34 AC 72 ms
15,232 KB
testcase_35 AC 77 ms
15,040 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/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=s.count('d(')>10000 ? [0] : eval(s)
puts A.concat((D+1-A.size).times.map{0}).join(' ')
__END__
d{x}は最大10000回しか現れないので、10000回以上d{が存在したら確実に0である。
0