Skip to content

Instantly share code, notes, and snippets.

View lxdlam's full-sized avatar
🎯
Focus

lxdlam lxdlam

🎯
Focus
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lxdlam on github.
  • I am lxdlam (https://keybase.io/lxdlam) on keybase.
  • I have a public key ASBYdzrDMl0af01MuzGzttpeXuDS7AWQQlRoBmRrr712kwo

To claim this, I am signing this object:

@lxdlam
lxdlam / ZOJ Monthly 2019.1 A.md
Created January 19, 2019 13:08
ZOJ Monthly 2019.1 A

ZOJ Monthly 2019.1 A

首先我们可以知道,杨辉三角第 $n+1$ 行的值是 $\binom{n}{i}, i \in [1,n]$。那么题意要求的可以转化为如下式子: $$ \sum_{i=1}^n(\binom{n}{i}\ \text{mod}\ 2) $$ 并且,一个很好的性质是 $2$ 是一个质数。 接下来考虑任意项$\binom{n}{m}\ \text{mod}\ 2,0\le m\le n$,我们对其应用 Lucas 定理,可以得到如下结果: $$ \binom{n}{m}\ \text{mod}\ 2\equiv \binom{n_{b_k}}{m_{b_k}}\cdot\binom{n_{b_{k-1}}}{m_{b_{k-1}}}\cdots\binom{n_{b_0}}{m_{b_0}}\ \text{mod}\ 2 $$

@lxdlam
lxdlam / lstm.ipynb
Created June 14, 2019 05:45
Learning LSTM
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <bits/stdc++.h>
using namespace std;
void print_vector(const vector<int>& vec) {
for (const auto& item : vec) {
cout << item << ' ';
}
cout << '\n';
@lxdlam
lxdlam / main.cpp
Created March 30, 2020 15:10
SRM 502 Div1 Medium
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 60;
const int MAXT = 1e5 + 10;
[package]
name = "playground"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.9", features = ["full"] }
thiserror = "1.0"
@lxdlam
lxdlam / bucket.go
Created May 10, 2021 09:27
A simple bucket based goroutine limiter
package main
import (
"fmt"
"sync"
"time"
)
type Limiter interface {
Commit(func())
// You need at least `nom = "7"` to work.
mod protocol {
use std::{fmt, str::FromStr};
use nom::Finish;
use self::parser::parse;
const DELIMITER: &str = "\r\n";
package http
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
)
from abc import ABC
from copy import deepcopy
from dataclasses import dataclass, fields
from datetime import datetime
from enum import Enum
from typing import Union, get_args, get_origin
from uuid import UUID
nt = type(None)