Skip to content

Instantly share code, notes, and snippets.

View pcchou's full-sized avatar

Ping-yu Chou pcchou

View GitHub Profile
@pcchou
pcchou / compile_sl_under_windows.md
Last active April 13, 2024 15:09
如何在 Windows 下編譯 sl (Steam Locomotive)

如何在 Windows 下編譯 sl (Steam Locomotive)

各位在剛剛算法班的課堂上,應該都透過講師大大體驗到 sl (Steam Locomotive) 的魅力了,相信大家都認為它是個好東西, 不過大家只看到在 Linux 上能享受 sl,想必身為 Windows 使用者的你一定很不是滋味吧!

在這裡,我將告訴大家如何在 Windows 上也能讓 sl 帶給你滿滿的趣味,讓你不再因為打錯 ls 而感到難過。(才怪)

Prerequisites

  • MinGW (如果有 DevC++ 或 CodeBlocks 應該就有)
#include <iostream>
#include <vector>
#include <assert.h>
#include <algorithm>
#include <queue>
#define debug 1
#define DBG if (debug) cout
#define A first
#define B second
#define ll long long
#!/usr/bin/python3
import json
import sys
import requests
def get_stats(uid):
return json.loads(requests.post("http://neoj.sprout.tw/api/user/{}/statistic".format(uid),
data="{}").text)
@pcchou
pcchou / linkedlist.c
Last active April 8, 2017 08:00
芭樂 linked list
// 不用 pointer 的 implementation, 然後其實是 doubly linked list
// 雙向 linked list 刪除比較好做
// 我其實沒編譯過
typedef struct linked_list_node {
int data; // 資料
int prev = -1, next = -1; // 上下一個的 index,所謂 doubly linked
// 一般其實是用 pointer 存啦
} node;
#include <iostream>
#include <queue>
#include <cmath>
using namespace std;
#define debug true
#define DBG if (debug) cout
struct Solution {
@pcchou
pcchou / CF740C.py
Last active November 23, 2016 23:01
R = lambda: map(int, input().split())
n, k = R()
mex = 10**9
for i in range(m):
l, r = R()
mex = min(mex, r - l + 1)
print(mex)
@pcchou
pcchou / test.cpp
Last active October 20, 2016 17:09
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <map>
#define INF 0x7fffffff
using namespace std;
priority_queue<int> wow[4 * 10001];
#include <stdio.h>
#include <string.h>
int ans[32];
int gcd(int a, int b) {
if (!a) return b;
return gcd(b % a, a);
}
@pcchou
pcchou / d655.c
Last active September 28, 2016 02:27
#include <stdio.h>
#define min(x, y) (x > y) ? y : x
int main() {
int val, noc, dp[1001] = {0}, denoms[9] = {1, 5, 10, 30, 50, 70, 100, 110, 500};
int i, j;
dp[0] = 0;
for (i = 1; i <= 1000; i++) dp[i] = 0x878787;
for (i = 0; i < 8; i++) {
@pcchou
pcchou / index.html
Created September 24, 2016 03:30
Simple JsBarcode Demo
<svg id="code39"></svg>