ToDo:
¤¬¥Û¥ó¥È¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤·¤è¤¦¡£
ºòÆü¤Ï gopku.rb
s = ''
`cpp #{ARGV[0]}`.split(/\n/).each do |l|
next if l =~ /^#/
s += l.sub(/^ */, '').chomp
end
File.open('out', 'w') do |o|
o.print s
end
p s.size
system("xclip < out")
PKU ¤Ë Submit ¤¹¤ë¤¿¤á¤Ë C ¤Î¥³¡¼¥É¤ò¥³¥á¥ó¥È½üµî¡¦¶õÇòºï½ü¤·¤Æ ¥³¥Ô¡¼¥Ð¥Ã¥Õ¥¡¤Ë¤Ä¤Ã¤³¤à¡£
º£Æü¤Ï prod.rb
|000>+|001>+|010>+|100>+|111> ¤¬ 4¹à¤Ç½ñ¤±¤Ê¤¤¤³¤È¤ò ¾ÚÌÀ¤·¤¿¤¤¤é¤·¤¤¤ó¤ÇÈ¿Îãõ¤·¤Ç ´Êñ¤Ê¥±¡¼¥¹¤À¤±¥Á¥§¥Ã¥¯¡£ ¤Þ¤¡·ë²Ì¸«¤Ä¤«¤é¤ó¤«¤Ã¤¿¡£
def get(s, i)
s & (1 << i) != 0 ? 1 : 0
end
def st(s, t)
if (t == 0)
s.to_s
else
['0+1','0-1'][s]
end
end
def state_str(s, t)
r = ''
for i in 0...12
r += '(' + st(get(s, i), get(t, i % 3)) + ')'
end
r
end
def addterms(as, *ts)
r = []
ts.each do |t|
as.each do |a|
b = t.dup
e = a.dup
if e =~ /^-/
e.sub!(/^-/, '')
if b =~ /^-/
b.sub!(/^-/, '')
else
b = '-' + b
end
end
r.push(b+e)
end
end
r
end
def addminus(t, m)
if m == 1
if t =~ /^-/
t.sub(/^-/, '')
else
'-' + t
end
else
t
end
end
for m in 0...16
p m
for t in 0...8
for s in 0...4096
st = Hash.new(0)
for i in 0...4
a = []
minus = get(m, i)
if get(t, 0) == 0
a.push(addminus(get(s, i*3).to_s, minus))
else
if get(s, i*3) == 0
a.push(addminus('0', minus))
a.push(addminus('1', minus))
else
a.push(addminus('0', minus))
a.push(addminus('-1', minus))
end
end
if get(t, 1) == 0
a = addterms(a, get(s, i*3+1).to_s)
else
if get(s, i*3+1) == 0
a = addterms(a, '0', '1')
else
a = addterms(a, '0', '-1')
end
end
if get(t, 2) == 0
a = addterms(a, get(s, i*3+2).to_s)
else
if get(s, i*3+2) == 0
a = addterms(a, '0', '1')
else
a = addterms(a, '0', '-1')
end
end
a.each do |at|
e = at.dup
if e =~ /^-/
e.sub!(/^-/, '')
st[e] -= 1
else
st[e] += 1
end
end
end
if st.key?('000') && st.key?('111') && st.key?('001') && st.key?('010') && st.key?('100') && st.size == 5
p state_str(s, t)
p st
end
end
end
end
(21:35)
| Á° | 2006ǯ 6·î |
¼¡ | ||||
| Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤ÆÊ¸¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£