以下のように記述すると、メッセージウィンドウ、キャラクター、フォント、マクロ などが初期化されます
; init
@call storage=library/main.ks
@init_indent
@init_blur_bg
@init_eye_close
@init_font_family
| # The MIT License (MIT) | |
| # | |
| # Copyright (c) 2015 nagat01 | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |
| open System | |
| open System.Collections.Generic | |
| let solve precision goods wmax = | |
| let indices = | |
| goods | |
| |> List.zip [0..goods.Length - 1] | |
| |> List.sortBy (fun(_, (w,v)) -> - v / w) | |
| |> List.map fst | |
| let ws, vs = goods |> Array.ofList |> Array.unzip |
| ;;;; library ;;;; | |
| @iscript | |
| f.kag = window.TYRANO.kag | |
| f.replace = function (arr, v, d) { | |
| arr.forEach(function(x) { if(x === v) d = x }) | |
| return d } | |
| f.extract = function(mp, arr, d) { | |
| for(var x in mp) d = f.replace(arr, x, d) |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| import qualified Data.IntSet as Set | |
| import Data.List(foldl') | |
| sieve n = step [2] (Set.fromList [3, 5 .. n]) | |
| where | |
| step ps cs = | |
| case Set.minView cs of | |
| Just (p, cs) -> |
| open System.Collections.Generic | |
| type Variable = A | B | C | D | E | F | G | |
| type Quaternion = W | X | Y | Z | |
| type Term = Quaternion * Variable list * float | |
| type Number = Term list | |
| let normalize (n:Number) = | |
| let n = n |> List.map (fun (q, vs, m) -> (q, List.sort vs, m)) | |
| let d = Dictionary() |
| <div>problem5 (10) = <p id="a10"></p></div> | |
| <div>problem5 (20) = <p id="a20"></p></div> | |
| <script> | |
| function problem5 (x) { | |
| var primes = []; | |
| for(i = 2; i < x; i++) { | |
| var isPrime = true; | |
| for(j = 0; j < primes.length; j++) { | |
| if(i % primes[j] == 0) | |
| isPrime = false; |
| open System | |
| let problem5 x = | |
| let primes = ResizeArray() | |
| for i in 2 .. x do | |
| if primes |> Seq.forall(fun p -> i % p <> 0) then | |
| primes.Add i | |
| primes | |
| |> Seq.map(fun p -> int(Math.Pow(float p, floor(Math.Log(float x, float p))))) | |
| |> Seq.reduce (*) |
| open MathNet.Numerics | |
| type BigRational with | |
| member __.s = | |
| let n, d = __.Numerator, __.Denominator | |
| sprintf "%Aと%A/%A" (n / d) (n % d) d | |
| type Human = Y | M | |
| type Point = A | B | C | D |
| // 結果 | |
| // 100000000回試行しました | |
| // 自分は生き、他に0人が生きた回数は27902回で確率は0.027902%でした | |
| // 自分は生き、他に1人が生きた回数は6924回で確率は0.006924%でした | |
| // 自分は生き、他に2人が生きた回数は848回で確率は0.000848%でした | |
| // 自分は生き、他に3人が生きた回数は87回で確率は0.000087%でした | |
| // 自分は生き、他に4人が生きた回数は4回で確率は0.000004%でした | |
| // 自分は生き、他に5人が生きた回数は0回で確率は0.000000%でした | |
| // 自分は生き、他に6人が生きた回数は1回で確率は0.000001%でした | |
| // 自分は生き、他に7人が生きた回数は0回で確率は0.000000%でした |