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
| Dir.glob("*.html").each do |fname| | |
| str = File.read(fname) | |
| if str !~ /<meta charset=/ | |
| str = str.sub(/<head\b[^>]*>/) {|s| s + '<meta charset="utf-8">' } | |
| File.write(fname, str) | |
| end | |
| 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
| # sqrt(-1) in Q_5 | |
| require "mathn" | |
| def e_p_int(x, p) | |
| e = 0 | |
| while x % (p**e) == 0 | |
| e += 1 | |
| end | |
| e - 1 |
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
| class Complex { | |
| x: number; | |
| y: number; | |
| constructor(x: number, y: number) { | |
| this.x = x; | |
| this.y = y; | |
| } | |
| add(other: Complex) { |
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
| <!-- 白黒画像を透過画像に変換する --> | |
| <body bgcolor="blue"> | |
| <script> | |
| let img=new Image; | |
| img.src="hierarchy-000001.png"; | |
| img.onload=()=>{ | |
| let canvas=document.createElement("canvas"); | |
| canvas.width=img.width; | |
| canvas.height=img.height; | |
| let ctx=canvas.getContext("2d"); |
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
| from edu.jas.arith import * | |
| from edu.jas.poly import * | |
| from edu.jas.gbufd import * | |
| br = BigInteger(0) | |
| vars = ["y", "x"] | |
| ring = GenPolynomialRing(br, len(vars), TermOrder(TermOrder.INVLEX), vars) | |
| a = ring.parse("x^3 - 3 x^2 - y + 1") | |
| b = ring.parse("-x^2 + y^2 - 1") |
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
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <functional> | |
| typedef long long ll; | |
| bool has_1_loop(std::vector<int> &v) { |
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.Ratio | |
| fact :: Integer -> Integer | |
| fact 0 = 1 | |
| fact n = (fact (n - 1)) * n | |
| solve2 :: Integer -> Rational | |
| solve2 m = sum $ map (\k -> sum [term r s | r <- [0..m], s <- [0..m], r + s == k && r + 2 * s <= m]) [1..m] | |
| where term r s = (-1)^(r+s-1)%(2^s*(fact r)*(fact s))*(product [1-i%m | i <- [0..r+2*s-1]]) |
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 qualified Data.Vector.Mutable as MV | |
| import qualified Data.Vector as V | |
| import Control.Monad.Primitive | |
| import Control.Monad | |
| myswap :: PrimMonad m => MV.MVector (PrimState m) a -> Int -> Int -> m () | |
| myswap v i j = do | |
| a <- MV.read v i | |
| b <- MV.read v j | |
| MV.write v i 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
| # 次の主張: | |
| # π: G→G/Z(G)を標準的な射影とすれば | |
| # φ: Syl_p(G)→Syl_p(G/Z(G)); H↦π[H] | |
| # がwell-defined 全単射 | |
| # を小さい群に対して確かめる | |
| list := [ | |
| ["S3", SymmetricGroup(3)], | |
| ["D8", DihedralGroup(8)], | |
| ["Q8", SmallGroup(8,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
| #include <stdio.h> | |
| #include <algorithm> | |
| #include "gmp.h" | |
| const int M = 3000; | |
| mpz_t fact[M+1]; | |
| mpz_t binomial[M+1][M+1]; | |
| mpz_t b[M+1][M+1]; | |
| mpz_t a[M+1]; |