def align(s,t) m = s.length() n = t.length() a = make2d(m+1,n+1) a[0][0] = 0 for j in 1..n a[0][j] = a[0][j-1] + g() end for i in 1..m a[i][0] = a[i-1][0] + g() end for i in 1..m for j in 1..n a[i][j] = max(a[i-1][j]+g(),max(a[i][j-1]+g(),a[i-1][j-1]+q(s[i-1],t[j-1]))) end end a end「a[i-1][j]+g()」,「」
ruby vote.rb 選択肢番号のように使います.