Skip to content

Instantly share code, notes, and snippets.

#http://www.logos.t.u-tokyo.ac.jp/www/home/chik/algorithm-design/08%20Graph%20Algorithms.pdfの38枚目を参考に
class OKAJIMA
def initialize(file_path)
@maze = Array.new()
open(file_path).each do |l|
@maze.push l.chomp.split(//)
end
@cost = Hash.new(1/0.0)
@det = Hash.new()
# -*- coding: utf-8 -*-
#Generalized Co-HITSを計算するスクリプト
#A Generalized Co-HITS Algorithm and Its Application to Bipartite Graphs
#Hongbo Deng* The Chinese Univ. of Hong Kong; Michael Lyu The Chinese University of Hong Kong; IRWIN KING Chinese University of Hong Kong
#http://portal.acm.org/citation.cfm?id=1557051
#入力は
#u_1 \t v_1 \t count
# -*- coding: utf-8 -*-
#/opt/lcoal/bin/ruby
#Query Clustering using Click-Through Graph
#http://portal.acm.org/citation.cfm?id=1526853
class BiGraph
def initialize
@nodes = Hash.new{|h,k|h[k] = 0}
@out_degree = Hash.new{|h,k|h[k] = 0}
@in_degree = Hash.new{|h,k|h[k] = 0}
;;;デフォ
(set-language-environment "Japanese")
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-locale-environment "utf-8")
(setenv "LANG" "ja_JP.UTF-8")
;;;みみっちい設定
\documentclass[11pt,a4paper]{jsarticle}
\title{離散最適化 課題3}
\date{\today}
\author{ore}
\begin{document}
\maketitle
\begin{equation}
(require 'ess-site)
(setq ess-ask-for-ess-directory nil)
(setq ess-pre-run-hook
'((lambda ()
(setq default-process-coding-system '(sjis . sjis))
)))
(set-language-environment "Japanese")
(set-default-coding-systems 'sjis)
(set-terminal-coding-system 'sjis)
#Monty Hall Dilemma
class Monty
def initialize(i)
@door = [:goat, :goat, :car]
@trial_time = i
end
def first_choice
return rand(@door.size)
end
team_mem = Hash.new{|h,k|h[k] = [ ]}
id_team = Hash.new{ }
id = [ ]
id_name = Hash.new{ }
tmp_team = ""
print "team? : "
tmp_team = gets.chomp!
#include <map>
#include <unordered_map>
using namespace std;
typedef pair<int, int> key_type;
int main(){
unordered_map<key_type,int> nemui;
nemui[key_type(1, 1)] = 100;
}
describe Hoge do
before do
@h = Hoge.new
end
describe Hoge, "メソッドAについて" do
it "0には1を返す" do
@h.method_a(0).should == 1
end
end
end