paizaオンラインハッカソン lite をPythonで解いてみた.
結果 は0.01秒.
単純に枝刈りしながら深さ優先探索するだけのコードだけど, あらかじめ単価の安い順にソートしておくのと, Solver.least_cost()
あたりの処理とで出来るかぎり浅いところで枝刈りされるようにしている.
とはいえ、このコードで TestCase7が0.01秒というのはちょっと速すぎる気がしないでもない.
# -*- coding:utf-8 -*-
paizaオンラインハッカソン lite をPythonで解いてみた.
結果 は0.01秒.
単純に枝刈りしながら深さ優先探索するだけのコードだけど, あらかじめ単価の安い順にソートしておくのと, Solver.least_cost()
あたりの処理とで出来るかぎり浅いところで枝刈りされるようにしている.
とはいえ、このコードで TestCase7が0.01秒というのはちょっと速すぎる気がしないでもない.
# -*- coding:utf-8 -*-
<?php | |
/** | |
* Simple excel writer class with no external dependencies, drop it in and have fun | |
* @author Matt Nowack | |
* @license Unlicensed | |
* @version 1.0 | |
*/ | |
class Excel { | |
private $col; |
#!/bin/bash | |
COMPASS="/var/lib/gems/1.8/bin/compass" | |
case "$1" in | |
""|start) | |
echo "Starting compass watch..." | |
if [ -f ./cwatch.pid ] | |
then | |
echo "Sorry, but compass is already watching this folder..." |
駅データ.jp から以下のようなファイルをダウンロードし、 db/seeds/ekidata
とか適当な場所に置く:
マイグレーション:
# db/migrate/XXXXXXXXXXXXXX_create_ekidata_stations.rb
#! /bin/sh | |
# | |
# データベース作成スクリプト. | |
# 引数に渡されたパスにデータベースを構成・データを投入する | |
# | |
# | |
# sample: | |
# sh createDatabaseAs.sh db.sqlite3 | |
# |
"------------------------------------ | |
" neosnippet | |
"------------------------------------ | |
" neosnippet "{{{ | |
" snippetを保存するディレクトリを設定してください | |
" example | |
" let s:default_snippet = neobundle#get_neobundle_dir() . '/neosnippet/autoload/neosnippet/snippets' " 本体に入っているsnippet | |
" let s:my_snippet = '~/snippet' " 自分のsnippet | |
" let g:neosnippet#snippets_directory = s:my_snippet |
require 'tmpdir' | |
# Usage: | |
# add to ruhoh-site/plugins/publish/github.rb | |
# - Your GitHub remote must be setup properly but The command will try to walk you through it. | |
# - You must have a clean working directory to publish to GitHub pages since the hook is actually triggered by commits. | |
# | |
# $ cd ruhoh-site | |
# $ bundle exec ruhoh publish github | |
class Ruhoh |
require 'randexp' | |
require 'faker' | |
require 'forgery' | |
I18n.enforce_available_locales = true | |
I18n.default_locale = :en | |
class Randgen | |
def self.rand_name(options = {}) | |
/#{Forgery::Basic.color}-#{Faker::Name.first_name}-\d{4}/.gen.downcase |
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
require 'optparse' | |
begin | |
require 'aws/profile_parser' | |
rescue LoadError; end | |
def conv_unit size |