Skip to content

Instantly share code, notes, and snippets.

@sat0b
sat0b / index.html
Created June 3, 2017 10:16
simple websocket
<!DOCTYPE html>
<html>
<head>
<title>simple websocket</title>
</head>
<body>
simple websocket
<script>
document.addEventListener('DOMContentLoaded', function() {
var ws = new WebSocket("ws://" + location.host + "/ws");
# 迷路の経路を出力
import copy
N = 10
M = 10
meiro = """\
#S######.#
......#..#
.#.##.##.#
# 迷路の最短路
# 蟻本 p.37
N = 10
M = 10
meiro = """\
#S######.#
......#..#
.#.##.##.#
# 水たまりのカウント
# 蟻本 p.35
lake = """\
W........WW.
.WWW.....WWW
....WW...WW.
.........WW.
.........W..
..W......W..
# 部分和問題 蟻本 p.34
# aからいくつか選び合計がkとなるかを判定
n = 4
a = [1, 2, 4, 7]
k = 13
def dfs(i, sum):
if i == n:
return sum == k
import sys
def main(eq):
eq = eq.replace("=", "==")
for i in range(0, 10):
try:
if eval(eq.replace("X", str(i))):
print("X=%d" % i)
return
import java.util.Scanner;
class Sanmoku {
private int[][] ban;
private static final int N = 3;
Sanmoku() {
ban = new int[N][N];
}
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
class Soroban {
public static void main(String[] args) {
int n = 0;
class Uzumaki {
public static void main(String[] args) {
int n = 0;
try {
n = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.err.println("Input Error : must be integer");
System.exit(1);
}
import java.util.Scanner;
class Hishigata {
public static void main(String[] args) {
int n = 0;
try {
n = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {