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 Util = | |
| let fordir x y f = | |
| for (dx, dy) in [ (-1, 0); (0, -1); (1, 0); (0, 1) ] do | |
| f (x+dx) (y+dy) | |
| open Util | |
| let size = System.Console.ReadLine() |> int | |
| let inputs = [| | |
| for x = 0 to size - 1 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
| exception Done of int | |
| let loopEnd = ref false | |
| while not !loopEnd do | |
| let [| width; height |] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
| if height = 0 && width = 0 then loopEnd := true | |
| else | |
| let maze = | |
| [| for x = 0 to height - 1 do | |
| yield System.Console.ReadLine().Split([|' '|]) |> Array.map int |] | |
| let start = ref (0, 0) |
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
| let [| height; width; cheeseSize |] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
| let maze = | |
| [| for x = 0 to height - 1 do | |
| yield System.Console.ReadLine().ToCharArray() |] | |
| let start = ref (0, 0) | |
| for h = 0 to height - 1 do | |
| for w = 0 to width - 1 do | |
| if maze.[h].[w] = 'S' then |
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
| let lineSize = System.Console.ReadLine() |> int | |
| for x = 0 to lineSize - 1 do | |
| let nums = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
| let suc = ref false | |
| let rec dfs i bMax cMax = | |
| if i < nums.Length - 1 then | |
| if nums.[i] > bMax then | |
| dfs (i+1) nums.[i] cMax | |
| if nums.[i] > cMax then |
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
| let ringo = '@' | |
| let kaki = '#' | |
| let mikan = '*' | |
| let loopEnd = ref false | |
| while not !loopEnd do | |
| let [|I; J|] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
| if I = 0 && J = 0 then | |
| loopEnd := true | |
| else | |
| let maze = |
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
| let blackTile = '.' | |
| let redTile = '#' | |
| let man = '@' | |
| let loopEnd = ref false | |
| while not !loopEnd do | |
| let [|I; J|] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
| if I = 0 && J = 0 then | |
| loopEnd := true | |
| else | |
| let maze = |
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 ElimArrayBoundCheck = | |
| type BIndex<'Tag>(idx) = | |
| member this.Idx = idx | |
| type BArray<'Tag, 'T>(arr : 'T[]) = | |
| member this.lookup(bidx : BIndex<'Tag>) = arr.[bidx.Idx] | |
| type C<'T, 'R> = interface | |
| abstract s<'Tag> : BIndex<'Tag> * BArray<'Tag, 'T> -> 'R | |
| abstract f : 'R | |
| end |
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 ; | |
| import js.JQuery; | |
| import js.Lib; | |
| enum Pair<A, B> { | |
| pair(a : A, b : B); | |
| } | |
| class Util { | |
| public static function fst<A, B>(p: Pair<A, B>) { |
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
| type A<'X, 'Y when 'X :> A<'X, 'Y> and 'Y :> B<'X, 'Y>> = interface end | |
| and B<'X, 'Y when 'X :> A<'X, 'Y> and 'Y :> B<'X, 'Y>> = interface end | |
| type C = inherit A<C, D> | |
| and D = inherit B<C, D> |
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
| (* | |
| type IFoo = | |
| abstract M1 : unit -> int | |
| abstract M2 : unit -> int | |
| このインターフェースの一部だけを実装した抽象クラス | |
| [<AbstractClass>] | |
| type Bar() = | |
| interface IFoo with | |
| override x.M1() = 0 | |
| が作れないのでF#でthisをプロパティにするアプローチは微妙。 |