Skip to content

Instantly share code, notes, and snippets.

StageData = <<END
##########
#.dd..p..#
#........#
#.oo.....#
#........#
##########
END
class Tile
#include "ford.h"
static const int32_t INF = 2147483647;
void ford(int32_t *d, size_t V, edge *es, size_t E, size_t s) {
for(int i = 0; i < V; i++)
d[i] = INF;
d[s] = 0;
while(true) {
bool update = false;
#include "dijkstra.h"
void dijkstra(int32_t *d, size_t V, Edge *es, size_t E, size_t s) {
const int INF = INT32_MAX;
bool used[V];
for(size_t i = 0; i < V; i++) {
used[i] = false;
d[i] = INF;
}
(define (accum x)
(lambda (i)
(if (= i -1)
x
(accum (+ x i))
)))
(define (even>odd? a b c d e)
(if (> ((((((accum
(if (even? a) 1 0))
(defn getchar []
(rand-nth
(sequence "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
(defn gen-stap [accum func]
(if (= (func (str (getchar) (getchar) (getchar) (getchar))) "STAP")
accum
(recur (+ accum 1) func)))
(println (gen-stap 1
@rigibun
rigibun / html.md
Last active August 29, 2015 14:02

htmlタグ

!DOCTYPE

ドキュメントのタイプを指定

<!-- html5 -->
<!DOCTYPE html>

1 import std.conv,
2 std.json,
3 std.stdio,
4 std.net.curl;
5
6 auto getTemperatureString(in JSONValue temperature) in {
7 assert(temperature.type == JSON_TYPE.OBJECT);
8 } body {
9 if(temperature["max"].type != JSON_TYPE.NULL && temperature["min"].type != JSON_TYPE.NULL)
10 return "最高気温: " ~ temperature["max"].object["celsius"].str ~ "℃\n"
struct TRUE(T, U)
{
alias T value;
}
struct FALSE(T, U)
{
alias U value;
}
unittest
@rigibun
rigibun / cons.d
Created June 24, 2014 13:55
Cons in Templates
struct CONS(T, U)
{
alias T car;
alias U cdr;
}
unittest
{
alias CONS!(int, CONS!(double, bool)) X;
assert(is(X.car == int));
s = ARGV[0];
puts "┏┷┓"
s.each_char do |c|
print "┃", c, "┃"
puts
end
puts "┗━┛"