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 distinct_ball_memo(dict): | |
def __missing__(self, key): | |
m, n = key | |
if n == 0: | |
return 1 | |
self[key] = m * self[(m, n-1)] + self[(m+1, n-1)] | |
return self[key] | |
def distinct_ball(n): |
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
# Number theoretic transform. | |
# Not O(n log n) but O(n^2). | |
P = (3<<30)+1 # 3221225473 | |
omega0 = 5 | |
omega0inv = 1932735284 | |
def mulmod(a, b): | |
return (a*b) % P |
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
# number theoretic transform implemented with FFT algorithm: O(n log n). | |
P = (3<<30)+1 # 3221225473 | |
omega0 = 5 | |
omega0inv = 1932735284 | |
def mulmod(a, b): | |
return (a*b) % P | |
OMEGA = {} |
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
* 基本進行 | |
** ディール | |
プレイヤーは均等な枚数のカードを得る。 | |
** 開始 | |
最初にプレイするプレイヤーは、連続ゲームであれば前回の勝利プレイヤーであり、そうでなければプレイヤーの合意する方法でランダムに選ぶ。 | |
** プレイ | |
プレイは手からカード集合を選んで場に出すこと (および、それに付随する効果を解決すること) である。最後にプレイされたカード (集合) をトップカード集合または省略してトップカードという。 | |
** アクティブなプレイヤー | |
ゲームの開始時には、すべてのプレイヤーはアクティブである。 | |
場が流れるたびに、すべてのプレイヤーはアクティブになる。 |
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
伊藤毅志 電気通信大学助教: 座長 | |
・完全情報ゲームの研究は区切りが見えてきた: 将棋や囲碁ではトッププロに迫るレベル。 | |
・これからは不完全情報ゲームの研究へシフトしていくであろう。 | |
松原仁 公立はこだて未来大学教授 (完全情報ゲーム)「完全情報ゲームから不完全情報ゲームへ」 | |
・ゲームは人工知能の課題として適している | |
- ルール (∋評価) が明確で人間の専門家もいる。 | |
●完全情報ゲーム | |
・必勝法 | |
- 二人零和有限確定完全情報ゲームには、いずれかのプレイヤーに必勝法が存在するか、または、双方が最善をつくすと引き分けになることが証明可能である。 |
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
' VB translation of http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/mt19937-64.c | |
Public Class MT | |
Private Const NN = 312 | |
Private Const MM = 156 | |
Private Const MATRIX_A = &HB5026F5AA96619E9UL | |
Private Const UM = &HFFFFFFFF80000000UL | |
Private Const LM = &H7FFFFFFFUL | |
Private mt(NN - 1) As ULong | |
Private mti As Integer = NN + 1 |
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
module main; | |
import std.stdio; | |
import std.conv; | |
import std.typecons; | |
auto proper_div(T)(T x, T y) | |
{ | |
T q = 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
def bs(a, b): | |
if a == b: | |
return a | |
if f(a) < 0: | |
return bs((a+b) / 2, b) | |
if f(b) > 0: | |
return bs(a, (a+b) / 2) | |
raise ValueError('something wrong :(') |
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
from time import sleep | |
def bs(a, b): | |
sleep(1) | |
if a == b: | |
return a | |
if f(a) < 0: | |
return bs((a+b) / 2, b) | |
if f(b) > 0: | |
return bs(a, (a+b) / 2) |
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 BF3(cost): | |
ret = 27 | |
a = range(3) | |
for a[0] in range(3): | |
for a[1] in range(3): | |
for a[2] in range(3): | |
if sorted(a) == range(3): | |
ret = min(ret, sum(cost[i][j] for (i, j) in zip(range(3), a))) | |
return ret |
OlderNewer