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
#coding: UTF-8 | |
#ドミニオンの圧縮戦略で、5枚以上のカードの情報(銀、金、属州礼拝堂)を与えると、その状態から属州を5枚買うまでの平均ターン数を返すプログラム。 | |
#適宜手動で実験してみてください。かなり理想化しているので、参考程度にどうぞ。 | |
#下記のプログラムによれば、結論としては、「属州を買えるときは常に属州を買おう。そうでないときは、マナブースト(この場合は金)を買おう」となりそう。 | |
#これは、圧縮戦略によらなそうな気もしているが、そこは自分でかんがえろ。 | |
#chokudaiが解析的に解いた結果、G3枚買ってから、上記の戦略に移るのが正しいとのこと。 | |
import random | |
moto = ['s','s','s','g','z']#sは銀貨、gは金貨、zは属州と礼拝堂 | |
lib = moto[:] |
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
SELECT P1.name, | |
P1.price, | |
(SELECT COUNT(P2.price) | |
FROM Products P2 | |
WHERE P2.price > P1.price) + 1 AS rank | |
FROM Products P1 | |
ORDER BY rank; |
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
sum = 25.0 | |
hit = 3.0 | |
def kai(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * kai(x-1) | |
bunbo = kai(sum) / kai(sum-5) |
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
sum = 25.0 | |
hit = 3.0 | |
def kai(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * kai(x-1) | |
bunbo = kai(sum) / kai(sum-5) |
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 prime(x:Int) = (2 to math.sqrt(x).toInt).toList.filter(a => x % a == 0).length == 0 && x != 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
javascript:(function(d){var ad = d.getElementById('adlyr'); ad.parentNode.removeChild(ad)})(document) |
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
var get_timeline = function(screenName) { | |
twttr.anywhere(function(a){a.User.find(screenName, { | |
success : function(user){ | |
user.timeline({ | |
page : 0, | |
count : 100, | |
success : function(r){console.log(r)}, | |
error : function(r){console.log(r)} | |
}); |
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
var get_timeline = function(screenName) { | |
twttr.anywhere(function(a){a.User.find(screenName, { | |
success : function(user){ | |
user.timeline({ | |
page : 0, | |
count : 100, | |
success : function(r){console.log(r)}, | |
error : function(r){console.log(r)} | |
}); |
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
$url = 'http://revinx.net/'; | |
$postdata = array( | |
'mode' => 'test' | |
); | |
$options = array('http' => array( | |
'method' => 'POST', | |
'content' => http_build_query($postdata), | |
)); | |
$contents = file_get_contents($url, false, stream_context_create($options)); |
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
//まず、jQueryでちゃんと取れるか試す | |
>$("#login_twitter") | |
<div id="login_twitter">…</div> | |
//とれたので、iframeの中身を試す | |
//過去の入力履歴を呼び出して、iframeの部分を書き足して実行 | |
>$("#login_twitter iframe") | |
[<iframe allowtransparency="true" frameborder="0" tabindex="0" role="presentation" scrolling="no" style="vertical-align: middle; width: 170px; height: 26px; ">…</iframe>] | |
//不安は杞憂だったようだ。余裕余裕。 |
OlderNewer