摘要: class Solution { public: ListNode* reverseKGroup(ListNode* head, int k) { ListNode* dummy=new ListNode(-1,head),*tail=dummy; while(tail) { ListNode* t 阅读全文
posted @ 2023-03-19 10:31 穿过雾的阴霾 阅读(18) 评论(0) 推荐(0)
摘要: #数学方法 class Solution { public: int maxProductAfterCutting(int n) { //特判一下n≤3的情况 if(n<=3) return 1*(n-1); int res=1; if(n%3==1) n-=4,res*=4;//拆出4 else 阅读全文
posted @ 2023-03-18 20:19 穿过雾的阴霾 阅读(21) 评论(0) 推荐(0)
摘要: class Solution { public: int cnt=0; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool st[55][55]; void dfs(int x,int y,int k,int rows, int cols) 阅读全文
posted @ 2023-03-18 10:36 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2023-03-18 09:57 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)
摘要: class Solution { public: int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool st[5][5]; bool dfs(vector<vector<char>>& matrix,int i,int j,int u,stri 阅读全文
posted @ 2023-03-17 20:43 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: class Solution { public: struct cmp { bool operator()(ListNode *a,ListNode *b) { return a->val>b->val; } }; ListNode* mergeKLists(vector<ListNode*>& l 阅读全文
posted @ 2023-03-17 15:51 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> fourSum(vector<int>& nums, int target) { vector<vector<int>> ans; long long tmp=target; sort(nums.begin() 阅读全文
posted @ 2023-03-16 21:48 穿过雾的阴霾 阅读(16) 评论(0) 推荐(0)
摘要: 1. 运行程序无事发生 #include <sys/types.h> #include <unistd.h> #include <iostream> using namespace std; int main() { int *x = NULL; free(x); return 0; } 2. gd 阅读全文
posted @ 2023-03-16 20:03 穿过雾的阴霾 阅读(35) 评论(0) 推荐(0)
摘要: 1. #include <sys/types.h> #include <unistd.h> #include <iostream> using namespace std; int main() { int x = 100; cout << x << endl; int pid = fork(); 阅读全文
posted @ 2023-03-16 19:32 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)
摘要: 1. python3 ./lottery.py -s 1 -c python3 ./lottery.py -s 2 -c python3 ./lottery.py -s 3 -c 2. 估计压根不会运行,如此不平衡导致进程饿死 python3 ./lottery.py -l 10:1,10:100 阅读全文
posted @ 2023-03-16 14:43 穿过雾的阴霾 阅读(7) 评论(0) 推荐(0)