摘要: #include<cstdio> #include<algorithm> const int N = 1e6 + 1; int n, t[N]; namespace lsh{ int lsh[N], tmp[N]; void init() { for (int i = 1; i <= n; ++i) 阅读全文
posted @ 2021-04-10 11:09 _dwt 阅读(52) 评论(0) 推荐(0)
摘要: **link:**http://poj.org/problem?id=2976 description: There are n courses, $a_i$is your grade, while the full marks is \(b_i\). The GPA calculate metho 阅读全文
posted @ 2021-03-17 20:12 _dwt 阅读(25) 评论(0) 推荐(0)
摘要: 组合数取模: 求1e18范围的组合数取模: 卢卡斯定理: \(\tbinom{m}{n} \equiv \tbinom{m\mod p}{n\mod p}\tbinom{m/p}{n/p}\mod p\) 求$i\mod p$逆元: 解不定方程组$i(inv)+py = gcd(i, p)=1$ c 阅读全文
posted @ 2021-03-12 22:01 _dwt 阅读(36) 评论(0) 推荐(0)
摘要: description: Color some of the cells of the \(n*n\) square's edge black, check if there exists an solution of given black cells of each edge. solution 阅读全文
posted @ 2021-03-05 21:29 _dwt 阅读(52) 评论(0) 推荐(0)
摘要: 实现了进制转换的简单算法(仅限正整数). #include<cstdio> inline int power(int x, int p) { int b = 1; while (p) { if (p & 1) b *= x; p >>= 1; x *= x; } return b; } inline 阅读全文
posted @ 2021-03-05 10:57 _dwt 阅读(18) 评论(0) 推荐(0)
摘要: Cantor Expansion: \(X = \sum_{i=1}^n (n-i)!\sum_{j=i+1}^{n}[p_i>p_j]\) It is a bijection from a permutation of \(p[1..n]\) to its dictionary order. We 阅读全文
posted @ 2021-03-04 17:55 _dwt 阅读(14) 评论(0) 推荐(0)
摘要: description: There are \(3\) buckets, whose volume are \(a,b,c\) respectly. How can you get \(k\) \(L\) oil by the three buckets? (Initially, the firs 阅读全文
posted @ 2021-03-03 08:44 _dwt 阅读(75) 评论(0) 推荐(0)
摘要: description: 9宫格, 其中有一个空位(0), 每次操作可以将一个与空位临接的数与空位交换, 问最少需要多少次达到目标123804765(实际上是12345678顺序围了一圈中间放0~)(像不像21世纪10年代手机里的拼图小游戏?) solution: 先手打一个临接表存储可能的状态转移 阅读全文
posted @ 2021-03-03 08:27 _dwt 阅读(51) 评论(0) 推荐(0)
摘要: description: There are two strings \(a\), \(b\) with the length \(n\), and \(m\). Find the Array <\(p_1, p_2, ..., p_m>\), such that \(a_{p_i}= b_i\), 阅读全文
posted @ 2021-02-28 08:43 _dwt 阅读(34) 评论(0) 推荐(0)
摘要: Link:https://codeforces.com/problemset/problem/1492/B description: You are given a deck of cards, numbered from \(1\) to \(n\). For each time you can 阅读全文
posted @ 2021-02-26 17:04 _dwt 阅读(73) 评论(0) 推荐(0)