This file contains hidden or 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 | |
# 問題: | |
# 偏りのない6面ダイスがある。 | |
# 4つの値から1つを偏り無く選びたい。 | |
# 値を選ぶ作業をn回繰り返す場合に、 | |
# なるべくダイスを振る回数を少なくするにはどうしたらよいだろうか。 | |
# 算術符号化を使って、@domain種の記号からなる列を、 | |
# @range種の記号からなる列に変換する。 |
This file contains hidden or 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 | |
t1s = Hash.new do 0 end | |
t2s = Hash.new do 0 end | |
all = Hash.new do 0 end | |
0.upto(5) do |r1| | |
0.upto(5) do |r2| | |
# 6進数で0 . r1 r2の36倍 | |
x0 = r1 * 6 + r2 |
This file contains hidden or 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
CREATE TABLE アイテム | |
TAG int, | |
武器_id int | |
武器_名前 | |
武器_攻撃力 int, | |
武器_両手持ち bool | |
盾_id int, | |
盾_名前 text, | |
盾_防御力 int | |
薬_id int, |
This file contains hidden or 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
-- CREATE TAGGED UNION TABLEでタグ付き和の列であるような表を作る。 | |
CREATE TAGGED UNION TABLE アイテム | |
TAG 武器 ( | |
id int, | |
名前 text, | |
攻撃力 int, | |
両手持ち bool | |
) | | |
TAG 盾 ( | |
id int, |
This file contains hidden or 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
interface Foo<T> { | |
void foo(T x); | |
} | |
class Bar implements Foo<Integer> { | |
public void foo(Integer x) { | |
} | |
// ERROR | |
public void foo(Object x) { |
This file contains hidden or 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
interface A { | |
} | |
interface B { | |
} | |
interface C { | |
} | |
// ERROR |
This file contains hidden or 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.util.*; | |
public class Main { | |
public static void main(String... args) { | |
int repeat = 100; | |
for (int i = 0; i < repeat; i++) { | |
int n = 1000000; | |
// benchCollection(n); |
This file contains hidden or 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
@testable import A | |
@ABC class Foo<A, B where B: C<[(D, E)]>>: F<[(G, | |
H)], | |
[I: | |
J]>, | |
K { | |
#if AAA | |
@DEF class func a() throws | |
-> A { |
This file contains hidden or 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 Foo | |
end | |
class Bar < Foo | |
end | |
class Baz < Bar | |
end | |
class Bar2 < Foo |
This file contains hidden or 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.util.Collections; | |
import java.util.List; | |
interface Apply<TypeConstructor, Param> { } | |
interface EmptyCollections<Coll> { | |
<Elem> Apply<Coll, Elem> empty(); | |
} | |
@SuppressWarnings("unchecked") |