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
| using System; | |
| namespace AOJ | |
| { | |
| class AOJ0202 | |
| { | |
| static void Main(string[] args) | |
| { | |
| var ps = Prims(1000000); |
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.List; | |
| import java.util.regex.MatchResult; | |
| import java.util.regex.Pattern; | |
| public class RegexSample { | |
| static public void main(String... args) { | |
| String str = "Trick or Treat"; | |
| Pattern pat = Pattern.compile("[a-zA-Z]"); | |
| String rep = Replacer.replace(str, pat, new ReplaceCallback() { |
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
| fizzbuzz(N, "FizzBuzz") :- 0 is N mod 15, !. | |
| fizzbuzz(N, "Fizz") :- 0 is N mod 3, !. | |
| fizzbuzz(N, "Buzz") :- 0 is N mod 5, !. | |
| fizzbuzz(N, X) :- swritef(Y, "%d", [N]), string_to_list(Y, X). | |
| print_fizzbuzz(N) :- fizzbuzz(N, X), writef("%s", [X]), nl. | |
| do_fizzbuzz :- foreach(between(1, 100, N), print_fizzbuzz(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
| {-# LANGUAGE DeriveFunctor, LambdaCase #-} | |
| import Control.Monad | |
| import Control.Monad.Trans | |
| import Control.Monad.Trans.Free | |
| import System.IO | |
| type Defer m = FreeT (DeferF m) m | |
| data DeferF m cont |
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 Data.Function | |
| import Graphics.UI.FreeGame | |
| main = do | |
| font <- loadFont "VL-PGothic-Regular.ttf" | |
| -- GUIParamの_windowedをFalseにするとフルスクリーンになる | |
| -- デフォルトはTrue | |
| -- (ウィンドウモードか、ってことらしい) | |
| -- 途中で変更は(多分)できない。 | |
| runGame (def {_windowed = False}) $ fix $ \loop-> do |
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
| function flatMap(xs, f) { | |
| return xs.reduce(function (ys, x) { | |
| return ys.concat(f(x)); | |
| }, []); | |
| } | |
| //=> [4, 12, 20, 28, 36] | |
| console.log(flatMap([1,2,3,4,5,6,7,8,9,10], function (x) { | |
| return x % 2 === 1 ? [x << 2] : []; | |
| })); |
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
| package main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| ) | |
| func test(input, except_ string) { | |
| actual := 0 | |
| except, _ := strconv.Atoi(except_) |
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
| <?xml version="1.0"?> | |
| <!DOCTYPE MODE SYSTEM "xmode.dtd"> | |
| <!-- Kuin用シンタックスハイライトファイル --> | |
| <!-- written by alucky0707 --> | |
| <MODE> | |
| <PROPS> | |
| <PROPERTY NAME="commentStart" VALUE="{" /> |
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
| function curry (fn) { | |
| return function curried() { | |
| var | |
| args = Array.prototype.slice.call(arguments, 0); | |
| return args.length >= fn.length ? fn.apply(this, arguments) | |
| : function () { | |
| return curried.apply(this, args.concat(Array.prototype.slice.apply(arguments))); | |
| }; | |
| }; | |
| } |
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
| (function () { | |
| var | |
| Proxy = require('harmony-reflect').Proxy; | |
| //aとbの編集距離 | |
| function levenDist(a, b) { | |
| var | |
| i, j, x, | |
| m = [[0]]; |