Skip to content

Instantly share code, notes, and snippets.

View yottahmd's full-sized avatar

YotaHamada yottahmd

View GitHub Profile
@yottahmd
yottahmd / Cheat.rb
Last active September 19, 2018 08:33
Ruby Cheat Sheet
#
#=Ruby Cheat Sheet for Beginner
#
##################################################
# 複数行コメント
##################################################
=begin
コメント
@yottahmd
yottahmd / gist:951b8367a269dcbfe347
Created October 31, 2014 09:05
Ruby Cheat Sheet for Beginner (Ruby初心者チートシート)
#
#=Ruby Cheat Sheet for Beginner
#
##################################################
# 複数行コメント
##################################################
=begin
コメント
@yottahmd
yottahmd / gist:b65b19598dc843b6baec
Created October 25, 2014 18:18
フロイドワーシャル法
#include <iostream>
#include <vector>
#include <map>
#include <climits>
using namespace std;
typedef pair<int, int> Edge;
typedef map<int, int> Vertex;
typedef vector<Vertex> Graph;
@yottahmd
yottahmd / gist:87c101091e2b8fe52993
Created October 25, 2014 18:10
四則逆算問題ランダム生成
(defparameter *problem-num* 10)
(if (> (length *args*) 0) (defparameter *problem-num* (parse-integer (car *args*))))
(setf *random-state* (make-random-state t))
(defun rand-elt (lst) (elt lst (random (length lst))))
(defun rand-range (min max) (let ((r (random (- max min)))) (+ r min)))
(defun 1+rand (m) (1+ (random m)))
(defun divisor-lst (num mindiv maxdiv)
(let ((lst '()))
(do ((n mindiv (1+ n)))
((or (>= n num)