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
| N = 1000 | |
| # s = N.times.each_with_object([1, 1]) { |_, a| a << 2*a[-2] + a[-1] } | |
| # p [s, s.size] | |
| # # https://www.crondose.com/2017/02/fibonacci-sequence-generator-ruby/ | |
| # s = N.times.reduce([1, 1]) { |a| a << 2*a[-2] + a[-1] } | |
| # # https://docs.ruby-lang.org/ja/master/class/Enumerator.html#S_NEW | |
| # enum = Enumerator.new { |y| |
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
| interface DisjointSets { | |
| fun connect(p: Int, q: Int) | |
| fun isConnected(p: Int, q: Int): Boolean | |
| } | |
| class DisjointSetsByArray(val elements: Int) : DisjointSets { | |
| private val map = IntArray(elements) { -1 } | |
| private fun top(id: Int): Int { | |
| if (id !in map.indices) return -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
| package main | |
| import ( | |
| "io/fs" | |
| "log" | |
| "net/http" | |
| "strings" | |
| ) | |
| func isVideoFile(name string) bool { |
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
| require 'nokogiri' | |
| require 'open-uri' | |
| base = 'https://ncode.syosetu.com' | |
| ncode = 'x0000xx' | |
| seen = i = 777 | |
| # start from #(seen + 1) chapter | |
| p out = `date -Im`.strip | |
| `mkdir #{out}` |
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 setup() { | |
| createCanvas(500, 500) | |
| background('lightgray') | |
| } | |
| function draw() { | |
| let side = 300 | |
| let third = side / 3 | |
| noStroke() | |
| translate(100, 100) |
NewerOlder