上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 23 下一页
摘要: a b mod p可以转换为 (a+a+a+a+.......+a) mod p 即为处理 a 2a 4a 8a .......... include using namespace std; int main(){ long long a,b,p; cin a b p; long long ans 阅读全文
posted @ 2019-01-20 00:05 INnoVation-V2 阅读(113) 评论(0) 推荐(0) 编辑
摘要: a^b 基础知识 求模就是取余 代码原理 例 3 ^ 7 mod 5 7 = 111 3 ^ 7 = 3^(111) = (3^001) (3^010) (3^100) = (3^1) (3^2) (3^4) 而 3 ^ 001 = 3 ^ 1 = 3 3 ^ 010 = (3 ^ 1)^2 = 9 阅读全文
posted @ 2019-01-19 22:22 INnoVation-V2 阅读(384) 评论(0) 推荐(0) 编辑
摘要: ``` class Solution { public: void print_board(const vector &ch) { int _pos = 0; cout &board, vector &ch, int x, int y, int n) { constexpr static int d 阅读全文
posted @ 2019-01-17 18:42 INnoVation-V2 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 方向数组+回溯 ``` 阅读全文
posted @ 2019-01-17 18:41 INnoVation-V2 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 78 子集 解法一.位运算 对于一个大小为m的数组,他共有2^m种组合,也就是有2^m个子集 例如 nums = [1,2,3] 那么他的子集则为 而我们知道任何一个整数的二进制表示是唯一的,所以我们可以利用这个特性解决这道题 例如 nums的大小为3,所以易知nums会有 2^3 =8个子集,我们 阅读全文
posted @ 2019-01-16 14:34 INnoVation-V2 阅读(184) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *merge(ListNode *l, ListNode *r) { auto *pRes = new ListNode(0); ListNode *temp = pRes; while (l != nullptr && r != nullptr) { if (l->val val) { temp->n... 阅读全文
posted @ 2019-01-14 16:49 INnoVation-V2 阅读(90) 评论(0) 推荐(0) 编辑
摘要: ```c++ vector splitListToParts(ListNode *root, int k) { vector vec; if (root == nullptr) { for (; k > 0; --k) vec.push_back({}); return vec; } int len =... 阅读全文
posted @ 2019-01-14 12:14 INnoVation-V2 阅读(145) 评论(0) 推荐(0) 编辑
摘要: ```c++ Node *flatten(Node *head) { Node *it = head; stack stack1; while (it) { if (it->child) { stack1.push(it->next); it->next = it->child; ... 阅读全文
posted @ 2019-01-12 23:34 INnoVation-V2 阅读(192) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *reverse(ListNode *head) { ListNode *front = head, *rear = nullptr, *temp = nullptr; while (front != nullptr) { temp = front->next; front->next = rear; ... 阅读全文
posted @ 2019-01-12 18:14 INnoVation-V2 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 自己写的不够简洁 阅读全文
posted @ 2019-01-12 18:02 INnoVation-V2 阅读(99) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 23 下一页