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
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <algorithm> | |
struct Cell | |
{ | |
int value; | |
int length; |
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
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <algorithm> | |
int get_length(const std::string& values, int pos, int lengths[]) | |
{ | |
if(std::isdigit(values[pos]) && (lengths[pos] == 0)) | |
{ | |
int l[] = |
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 das28_crp(tjc, sjc, crp, pga) | |
# pga は 0〜100 を期待している | |
0.56 * Math.sqrt(tjc) + 0.28 * Math.sqrt(sjc) + 0.36 * Math.log(crp * 10 + 1) + 0.014 * pga + 0.96 | |
end | |
def das28_esr(tjc, sjc, esr, pga) | |
# pga は 0〜100 を期待している | |
0.56 * Math.sqrt(tjc) + 0.28 * Math.sqrt(sjc) + 0.70 * Math.log(esr) + 0.014 * pga | |
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
#include "simple.h" | |
// {'B' => 456, 'A' => 123} | |
typedef Environment<NamedNumber<'B', 456>>::Merge<NamedNumber<'A', 123>>::environment environment; | |
// B => 456 | |
auto b = Variable<'B'>::Evaluate<environment>::value; | |
// B + A => 579 | |
auto aadd_b_a = Add<Variable<'B'>, Variable<'A'>>::Evaluate<environment>::value; |
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
#!/usr/bin/ruby | |
# coding: utf-8 | |
require 'date' | |
begin | |
raise unless ARGV.size == 3 | |
date_range = ARGV.shift.match(/(\d{1,2}\/\d{1,2})-(\d{1,2}\/\d{1,2})/) { Date.parse($1)..Date.parse($2) } | |
start_time, end_time = ARGV.shift.match(/(\d{1,2}\:\d{1,2})-(\d{1,2}\:\d{1,2})/) { [DateTime.parse($1), DateTime.parse($2)] } | |
step = ARGV.shift.to_f |
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
Gem::Specification.new do |spec| | |
spec.name = "nullpo" | |
spec.version = "0.0.1" | |
spec.authors = ["e.mattsan"] | |
spec.email = ["e.mattsan@gmail.com"] | |
spec.summary = "null pointer" | |
spec.files = ["nullpo.rb"] | |
spec.require_path = "." | |
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
# 修正したコード | |
def decode(code_sets) | |
size = code_sets.first.inject(&:+) | |
board = size.times.map { [0] * size } | |
depth = [0] * size | |
code_sets.each do |code_set| | |
y = depth.min | |
x = depth.find_index(y) | |
# puts "decode (%d, %d)" % [x, 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
:- initialization(main). | |
split(Input, [Point|Points]) :- | |
append(Point, [0',|Rest], Input), | |
split(Rest, Points), | |
!. | |
split(Point, [Point]). | |
min(Xs, X) :- sort(Xs, [X|_]). | |
max(Xs, X) :- sort(Xs, Sorted), reverse(Sorted, [X|_]). |
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
3:Oh,Be,AF,in,eG,ir,l5,Q8,mC,7T,Ty,tT 108,1920 | |
3:00,zz,0z,z0 - | |
1:ho 1,3844 | |
2:am - | |
4:00,zz,0z,z0 3844,3844 | |
4:00,11,zz,yy,1y,y1 3600,3721 | |
2:00,01,10,11,yz,zy,yy,zz 2,3660 | |
2:AA,AB,BA,BB,SZ,SY,TZ,TY 2,2046 | |
3:Lw,qw,cw,Ow,2w,fw,yw,ow,Zw,iw 7,2170 | |
4:0o,0s,0x,0C,0L,0k,0V,0y,0m,0S 9,2852 |
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
min_area = (pos('m') - pos('e') + 1) * (pos('G') - pos('5') + 1) |