2010年1月24日日曜日

(酔)

酔った勢いで
「むきょー」とか送ってしまった
僕死ねばいいのに
最後ページまでの
観閲が1増えるだけで嬉しくて死ねる

こんなゴミ人間でも
生きていてイイんだ!
と思える瞬間
例の数珠を求めるrubyのスクリプト

require 'set'

class Array
def psum( i, n ) begin
sum = 0
l = self.length
for i.upto(i+n-1) do |j| begin
return nil if self[j].nil?
index = j % l
sum = sum + self[index]
end

return sum
end

def which_nil
self.each_index do |i|
return i if self[i].nil?
end
return nil
end
end

def M(n) begin
return n*(n-1)+1
end

def check( a ) begin
s = Set.new( [] )
n = a.length
for 1.upto(n-1) do |k|
for 0.upto(n-1) do |i|
sum = a.psum(i,k)
if !sum.nil? begin
if s.include?(sum) || sum>M(n)
return nil
else
s.add( sum )
end
end
end
end
sum = a.psum(0,n)
return nil if !sum.nil? && sum>M(n)
return s
end


#配列中に i の数字を作る部分列を作るようにする
def search( a, created, i ) begin
if created.include?(i)
if i==M(a.length)
p a
return
else
search( a, created, i+1 )
end
else
# i を追加する
b = a
a.each_index |j|
if a[j].nil?
b = a.clone
b[j]=i
s = check( b )
if s.nil?
search( b, s, i+1 )
end
end
end
end
end


n = 6   #数珠の個数
for n.times
a.push(nil)
end

search( a, Set.new([]), 1 )

2010年1月23日土曜日

・・・・・ ・・・・・・ ・・・・・・・・・・・・・・・・ ・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・ ・・・ ・・・・・・ ・・

・・ ・・・・・・・・・・・・・・・ ・・・・・・・・・・・
・・・・・・・・・ 
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・ 
・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・
 ・・・・・・・・・・・・・ ・・・・・・・・・・・
・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・
 ・・・・・・・・・・・・・・・・・・
 ・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・k・・・・・・・・・・・
・・・・・・・・・・・・・・・

・・・・・・・・・ ・・・・・・・・・ ・・・・・・・・・・・・・・
・・・・・ ・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・
・・・・・・・・ ・・・・・・・・・・・・・ ・・・・・・・・・¥
 ・ ・ ・・・・ ・・・・ ・・・・・・ ・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・
・・・・・・・・・・ ・・・・・・・・・・・・・・
・・・・・ ・・・・・・・・・ ・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・ ・・・・・・・・・・・
・・・・・・・ 
・・・・・・・・・・・・・・・・・・・:

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・ ・・・・・・・・・ ・・・・・・・・・ ・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・
・・・・・・・・・・
・・・・・・・・・
・・・・・・・・・・・・・・・・・・・

・・・・・・・・
・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・
・

・・・・
・・・・・・・
・・・・・
・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・
・・・・・・・・・・・・・・・ 
・・・・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・
・・ ・・ ・・ ・・ ・・

・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・
・・・ ・・・ ・・・ ・・・

・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・
・・・・・・
・
・・・・・・・・・・・・・・・・・・・・・・  ・・・・
・・・・・・

・・・・・・・・・・   ・・・・・・・・・・・

・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・

…・・・・・ ・・・・・・

2010年1月22日金曜日

教訓

力を抜くのはベテランの特権であり高等技術
素人が効率を理由にして最初から力を抜こうとしてはいけない