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
height, width = gets.split(' ').map(&:to_i) | |
# bitとして扱う | |
lines = [] | |
(1..height).each do |h| | |
lines << gets.chomp.to_i(2) | |
end | |
# 対象を解析 | |
targets = {} |
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
# 再帰的探査 | |
def search(list, i, need, nco, maxind, mincost, limit_mem) | |
c = list[i] | |
nmem = need - c[0] | |
cost = nco + c[1] | |
return mincost if cost > mincost # すでにわかっている答えより大きいので無駄 | |
return cost if nmem <= 0 # メンバーが埋まった | |
return mincost if i >= maxind # 終端までいったが、メンバーが埋まらない | |
# 自身の効率*残り人数+現在のcostがmincostを超える |
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
https://paiza.jp/poh/enkoi | |
Ruby / CoffeeScript |
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
class Fibonacci | |
class << self | |
include Enumerable | |
def each | |
(1..Float::INFINITY).lazy.each do |i| | |
yield fib(i) | |
end | |
end |
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
searchArcanas = (query, path, component, callback) -> | |
component.setState(showError: false) | |
$("#loading-modal").modal('show') | |
query ?= {} | |
query.ver = $("#data-ver").val() | |
url = $("#app-path").val() + path | |
callbacks = | |
done: (as) -> | |
callback(as, component) | |
$("#loading-modal").modal('hide') |
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
https://paiza.jp/poh/enshura |
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
https://paiza.jp/poh/joshibato/ | |
kirishima.rb | |
https://paiza.jp/poh/joshibato/kirishima/result/4d6681fb | |
rio.rb | |
https://paiza.jp/poh/joshibato/tsubame/result/f494a598 | |
tsubame.rb | |
https://paiza.jp/poh/joshibato/tsubame/result/f494a598 |
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 java.io.PrintWriter | |
import scala.collection.mutable.ListBuffer | |
import scala.io.Source | |
import scala.actors._ | |
import scala.actors.Actor._ | |
object RecommendIndexBuilder { | |
// Massage for Actors | |
case class Ready() |
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
(function() { | |
var Fragment, FragmentController, FragmentView, User, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
$.ajaxSetup({ | |
cache: false | |
}); | |
User = (function() { |
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
# coding: utf-8 | |
# n=5で50%のつもり | |
def hit?(n) | |
rand(10) <= (n-1) ? true : false | |
end | |
# パターン1:かぶりなし=10回成功したら終わり | |
def pattern1(r) | |
count = 0 |
OlderNewer