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
| -module(sleepmonster). | |
| -compile(export_all). | |
| %% 武器・モンスター対応表 {武器, 倒せるモンスター, 得られる武器} | |
| table() -> [{$a, $B, $c}, {$c, $D, $e}, {$e, $F, $g}, | |
| {$g, $H, $i}, {$i, $J, $k}, {$k, $L, $a}]. | |
| %% 解く | |
| solve(Data) -> | |
| Arms = lists:usort([X || X <- Data, X > $Z]), % 小文字のみ集める |
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
| %% トップクラスだけが知る「このアルゴリズムがすごい」 - 「探索」基礎最速マスター | |
| %% http://www.itmedia.co.jp/enterprise/articles/1002/06/news001_3.html | |
| -module(cutsticks). | |
| -compile(export_all). | |
| %% 最大試行回数 | |
| -define(MAXTRIALS, 100). | |
| %% 解く |
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
| -module(subpalin). | |
| -compile(export_all). | |
| %% 解く | |
| solve(Data) -> integer_to_list(palinnum(Data)). | |
| %% 回文の最大長を返す | |
| palinnum([]) -> 0; | |
| palinnum(L) -> lists:max([palinnum2(S) || S <- tailcombi(L)]). |
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
| javascript:var e,i,p,u,m,k="1e100.link/";e=document.getElementsByTagName("a");for(i=0;i<e.length;i++){u=e[i].getAttribute("href");if(u&&u.indexOf(k)>=0){e[i].setAttribute("href",u.replace(k,""));}if(u&&u.match(/jpg|jpeg|png|gif/i)){e[i].setAttribute("target","_blank");}if(u&&u.indexOf("amazon.jp/")>=0){e[i].firstChild.style.border="dashed 2px red";}}e=document.getElementsByTagName("i");for(i=0;i<e.length;i++){if((e[i].textContent=="DELETED")||(e[i].textContent=="CHECKING")){p=e[i].parentNode;u=p.getAttribute("href");m=document.createElement("img");p.appendChild(m);m.setAttribute("src",u.replace("newpage:",""));m.style.border="solid 1px yellow";}}; |
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
| # 16進数→2進数 | |
| s/0/0000/g | |
| s/1/0001/g | |
| s/2/0010/g | |
| s/3/0011/g | |
| s/4/0100/g | |
| s/5/0101/g | |
| s/6/0110/g | |
| s/7/0111/g | |
| s/8/1000/g |
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
| # 数→椅子 | |
| s/1\([0-9]\)/55\1/ | |
| s/2\([0-9]\)/5555\1/ | |
| s/3\([0-9]\)/555555\1/ | |
| s/9/54/ | |
| s/8/53/ | |
| s/7/52/ | |
| s/6/51/ | |
| s/5/-----/g | |
| s/4/----/ |
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
| -module(lcove). | |
| -compile(export_all). | |
| %% 解く | |
| solve(Data) -> | |
| % 1の位と10の位に分ける関数 | |
| F = fun(SX) -> X = list_to_integer(SX), {X div 10, X rem 10} end, | |
| area([F(SX) || SX <- string:tokens(Data, ",")]). | |
| %% L字型の面積を求める |
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
| javascript:(function(){location.href=location.href.replace(/\?.*$/,'');})(); |
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
| -module(boseg). | |
| -compile(export_all). | |
| solve(Data) -> | |
| string:join([integer_to_list(X) || X <- boundlen(oct2bin(Data))], ","). | |
| oct2bin([]) -> []; | |
| oct2bin([X, Y | T]) -> [string:right("00000" ++ | |
| integer_to_list(list_to_integer([X, Y], 8), 2), 6) | oct2bin(T)]. |
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
| -module(xysort). | |
| -compile(export_all). | |
| table() -> [ | |
| [4, 1, 4, 2, 1, 3], [7, 3, 2, 0, 5, 0], [2, 3, 6, 0, 6, 7], | |
| [6, 4, 5, 7, 5, 1], [3, 1, 6, 6, 2, 4], [6, 0, 5, 5, 5, 1]]. | |
| solve(Data) -> [X + $0 || X <- hd(lists:foldl(fun(C, Tbl) -> | |
| sort(C, Tbl) end, table(), Data))]. |