This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
case class Step(row:Int, column:Int, char:Char) | |
object Labyrinth { | |
private val n = 50 // 行 | |
private val m = 50 // 列 | |
private val labString = | |
""".S.#.##.####.##....#..#..#........................ | |
|.#.#............##.#.###.#.###.##################. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object Donyoku { | |
case class Work (start:Int, terminal:Int) | |
def main(args: Array[String]) { | |
val listStart = List(19, 34, 5, 39, 6, 17, 43, 13, 33, 6, 25, 10, 3, 32, 30, 25, 23, 20, 38, 31, 39, 10, 34, 47, 49, 37, 19, 28, 20, 17, 22, 20, 40, 0, 20, 6, 49, 46, 0, 23, 41, 13, 0, 14, 49, 41, 36, 46, 3, 28, 27, 29, 22, 37, 47, 16, 31, 14, 30, 27, 35, 49, 0, 44, 40, 49, 41, 1, 6, 39, 37, 4, 39, 10, 31, 3, 37, 18, 47, 13, 47, 33, 4, 0, 34, 36, 42, 17, 1, 38, 30, 35, 8, 5, 1, 4, 7, 17, 26, 35) | |
val listTerminal = List(34, 67, 39, 62, 32, 49, 50, 13, 43, 23, 25, 16, 48, 51, 37, 68, 46, 42, 51, 49, 76, 14, 79, 48, 87, 73, 54, 34, 65, 23, 44, 51, 49, 3, 41, 7, 86, 72, 25, 30, 63, 13, 39, 27, 88, 89, 57, 46, 31, 58, 61, 75, 34, 85, 93, 49, 54, 61, 56, 72, 54, 51, 6, 46, 50, 59, 73, 33, 31, 86, 61, 37, 81, 16, 64, 39, 85, 42, 57, 40, 62, 69, 28, 30, 38, 57, 66, 47, 36, 38, 35, 45, 30, 46, 45, 37, 16, 26, 42, 43) | |
val works = listStart.zip(listTerminal).map(t => Work(t._1, t._2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// S1...Si+1とT1...Ti+1に対する共通部分列は、 | |
// ・Si+1=Tj+1の時、S1...SiとT1...Tiに対する共通部分列の後ろにSi+1をつなげたもの | |
// ・S1...Si+1とT1...Tiに対する共通部分列 | |
// ・S1...SiとT1...Ti+1に対する共通部分列 | |
//と漸化式を立てることができるのでそれを以下のように動的計画法の結果を保持する | |
//DPデーブルとして実装する | |
object DynamicPrograming { | |
def main(args: Array[String]) { | |
val s = "kgsbyshnthednsehtrgabjmnhnkafwwrnpsuxdbrmfggsgjdrfbcpjyshxdtirzzpytngmjwmfjtduftiwufmxmduxehmtkbureziurphzjzbwwayxuwaandywbneinkiyurhbtkmsbkmmnbjiriupxchtpbsefrnwbhhtxndbdpgdhkjmrtkafxaxziajwweczbsarjuukemchsrbusjnexwwrumsferygnuhkyiadrdrrzxzusxwfcazgmejintyjesfdbdewekepezmmtfwbuynwcustjmzwjxgcbcdxxrrkfpjygidaebatjnweyhryejgzmdmjhdpziucxdtxgcmjjdsjdkmhsdkperpfchcbsszimehtzacmdjpzusnunzcnmrejkjnhuhgmdwpcdnfgdzszrjyjibfkgagmadzkfhzmwesrkgcwruaynadizrngpdimbxhtkaiezhrkgxhdtdmjkptzprsxkbtuzfkpumxenwkminrdeaeftheamxcenzasjkabypgkgrytnyszeunszkcihuuyfcfacdxaepjknekfjeigcnhngufuxbtawtuyhrbehnbhxyfjgrgwywhzsgnptcmtmfkawjtnrybmuwgydrdhbjkgbufsaaeniyywyukmkwsbttprusuejceaupbsyywpwpehsduzngmxrepwabhpdgybhxfbyywxspzznsjfpbetgkfpyweyumrjijukhxb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object Expedition { | |
// ガソリンスタンドとゴールを同一視する | |
trait Spot {def position():Int; def gas:Int} | |
case class GasStand(position:Int, gas:Int) extends Spot | |
case class Goal(position:Int, gas:Int) extends Spot | |
object GasOrder extends Ordering[Spot] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Union-Find木におけるノードを表すクラス | |
*/ | |
class Node | |
{ | |
/** | |
* @var int 親のindex 自身が根の場合は自身のindexとなる | |
*/ | |
private $parentIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object FoodChain { | |
def main(args: Array[String]) { | |
/** | |
* 情報を定義する値オブジェクト | |
* @param infoType | |
* @param x | |
* @param y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object Roadblocks { | |
case class Road(from:Int, to:Int, distance:Int) | |
case class Next(position:Int,totalDistance:Int) | |
def main(args: Array[String]) { | |
// val crossPointNumber = 4 | |
// var edgeCount = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
cd ~/.rbenv/plugins/ruby-build | |
sudo ./install.sh | |
mkdir -p ~/local/src | |
mv ~/.rbenv/plugins/ruby-build ~/local/src | |
rm -rf ~/.rbenv | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc | |
echo 'eval "$(rbenv init -)"' >> ~/.zshrc | |
source ~/.zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.slick.lifted._ | |
import java.util.Date | |
import org.joda.time.DateTime | |
import scala.slick.driver.{BasicDriver, BasicProfile} | |
import scala.slick.session.{PositionedResult, PositionedParameters} | |
import scala.language.implicitConversions | |
/** | |
* [[org.joda.time.DateTime]]を[[java.sql.Date]]にSlickにおいて暗黙変換して利用する | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd ~ | |
$ mkdir -p ~/local/source | |
$ cd ~/local/source | |
$ wget "http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz" | |
$ tar xzvf ncurses-5.9.tar.gz | |
$ cd ncurses-5.9 | |
$ ./configure --prefix=$HOME/local | |
$ make | |
$ make install | |
$ cd .. |