本学では、学内システム ISUCHOLAR が使用されています。 科目の履修から課題の提出、成績の処理まで学内の全業務に用いられる ISUCHOLAR ですが、すべてが重いと学生や教員から多くの不満が寄せられています。 システム担当者は明後日から始まる新年度に向けて ISUCHOLAR の改修を依頼しましたが、巡り巡ってあなたに許された時間は 8 時間しかないようです。 なんとか期限までに ISUCHOLAR を改善し、素敵なキャンパスライフを提供しましょう!
This file contains 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
export class WeightedDie { | |
private readonly n: number | |
private readonly prob: readonly number[] | |
private readonly alias: readonly number[] | |
public static fromWeightFn(n: number, weight: (i: number) => number): WeightedDie { | |
return new WeightedDie(new Array(n).fill(0).map((_, i) => weight(i))) | |
} | |
public constructor(weights: number[]) { |
This file contains 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" | |
"io/fs" | |
"path/filepath" | |
"strings" | |
"github.com/lukesampson/figlet/figletlib" | |
"github.com/mbndr/figlet4go" |
This file contains 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 ( | |
"flag" | |
"io" | |
"log" | |
"net/http" | |
"time" | |
) |
This file contains 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 traq-message-indexer messages cache | |
SELECT c.name AS "channel_name", u.name AS "related_user_name", COUNT(*) AS "messages_count" FROM message m | |
# restrict to times messages | |
INNER JOIN channel c ON m.channel_id = c.id | |
INNER JOIN user u ON m.user_id = u.id | |
# drop own messages in their own times | |
WHERE u.name != c.name | |
# drop bot relations | |
AND NOT u.bot | |
GROUP BY m.channel_id, m.user_id |
This file contains 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
const product = (s1, s2) => s1.flatMap(elt1 => s2.map(elt2 => [...elt1, ...elt2])); | |
const power = (s, p) => new Array(p).fill(s).reduce(product, [[]]); | |
const bool = [[0], [1]]; | |
const and = (...x) => {const base = (x, y) => x * y; return x.reduce(base, 1)}; | |
const or = (...x) => {const base = (x, y) => x + y - x * y; return x.reduce(base, 0)}; | |
const xor = (...x) => {const base = (x, y) => x + y - 2 * x * y; return x.reduce(base, 0)}; | |
const nand = (...x) => 1 - and(...x); | |
const dual_func = f => (...x) => (v => v === '*' ? '*' : 1 - v)(f(...x.map(t => 1 - t))); |
This file contains 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.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Objects; | |
import java.util.Set; | |
import java.util.StringTokenizer; |
This file contains 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.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Objects; | |
import java.util.Set; | |
import java.util.StringTokenizer; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; |
This file contains 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 ( | |
"bufio" | |
"fmt" | |
"os" | |
"strings" | |
"strconv" | |
"sync" | |
"time" |
NewerOlder