摘要: 引出 一些取模的基本运算: (a+b)%p=(a%p+b%p)%p 对 (a-b)%p=(a%p-b%p)%p 对 (a×b)%p=(a%p×b%p)%p 对 (a/b)%p=(a%p/b%p)%p 错 一些符号的说明 ≡: a≡b(mod p) 表示 a和b分别模p,余数相同,即a和b对p取模同余 阅读全文
posted @ 2020-12-19 10:52 SeekHummingbird 阅读(946) 评论(0) 推荐(0)
摘要: #include<cstdio> const int maxn=5*1e3+1e2; int n,m; struct DSU{ int dad[maxn]; int anc(int x) { if(dad[x]) return dad[x]=anc(dad[x]); else return x; } 阅读全文
posted @ 2020-11-14 21:44 SeekHummingbird 阅读(92) 评论(0) 推荐(0)
摘要: #include <cstdio> struct node { int key; node* rt; node(int _key, node* _rt) { key = _key; rt = _rt; } }; node *root; void init() { root = new node(-1 阅读全文
posted @ 2020-11-14 17:57 SeekHummingbird 阅读(129) 评论(0) 推荐(0)
摘要: #include <cstdio> struct Stack { struct node { node* below; // 这个元素的下面那个元素 int key; // 这个元素的值 } *nowTop; void push(int x) { // 向栈顶压入一个数 node* todo = n 阅读全文
posted @ 2020-11-14 15:25 SeekHummingbird 阅读(247) 评论(0) 推荐(0)
摘要: 例题: 题目描述 迷宫用 n*mn∗m 的网格表示,分为以下四种格子: X:墙,不能通过 .:空地,可以通过 ^:陷阱(开启):可以通过,但行动后如果处在开启的陷阱上上会额外消耗1点体力 _:陷阱(关闭):可以通过 每次你可以从当前格子花费1点体力进行一次行动,包括移动到上下左右四方向的某一个可以通 阅读全文
posted @ 2020-11-14 10:19 SeekHummingbird 阅读(193) 评论(0) 推荐(0)