上一页 1 ··· 5 6 7 8 9 10 11 12 13 14 下一页
摘要: class Solution { public: int findContentChildren(vector<int>& g, vector<int>& s) { //贪心解法,用用尽量小的需求去满足孩子,所以需要先排序 sort(g.begin(),g.end()); sort(s.begin( 阅读全文
posted @ 2021-01-19 16:25 loliconsk 阅读(90) 评论(0) 推荐(0)
摘要: 先判断一种皇后的放置方法,然后再去判断另一种皇后的放置方法代码如下 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int queue[10]; int queueB[10]; int sum = 0; 阅读全文
posted @ 2021-01-19 11:29 loliconsk 阅读(159) 评论(0) 推荐(0)
摘要: 移除链表元素只需要把指向下一个节点的值改变就可以删除元素,一般在链表前面加一个伪头会更方便计算,所以需要新定义一个节点指针去指向头head,分别用pre 和 cur来判断是否是要删除的元素,然后改变next的值,注意不要利用伪头或head直接去判断,不然返回的只有最后一个节点 /** * Defin 阅读全文
posted @ 2021-01-19 10:15 loliconsk 阅读(144) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<math.h> int queue[8]; int sum = 0; void show() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j+ 阅读全文
posted @ 2021-01-18 15:47 loliconsk 阅读(79) 评论(0) 推荐(0)
摘要: 这是一道模拟题,我们首先定义一个二维数组,然后将他的边界定义出来,定义好边界后就开始往数组中放数字,每次到达边界,就改变方向,但注意奇数的螺旋矩阵最中间的数需要自己定义,否则会造成死循环 以下代码实现(优化前) #include<stdio.h> #include<string.h> #includ 阅读全文
posted @ 2021-01-18 10:27 loliconsk 阅读(189) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-01-18 09:01 loliconsk 阅读(36) 评论(0) 推荐(0)
摘要: #include<stdio.h> unsigned long long max(unsigned long long a, unsigned long long b) { if (a > b) return a; else return b; } int main(void) { int hors 阅读全文
posted @ 2021-01-18 08:50 loliconsk 阅读(128) 评论(0) 推荐(0)
摘要: Matlab 官方文档: https://www.mathworks.com/help/ 阅读全文
posted @ 2021-01-16 19:09 loliconsk 阅读(66) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> void prefix_table(char pattern[], int prefix[],int n) { prefix[0] = 0; int len = 0; int i = 1; 阅读全文
posted @ 2021-01-16 15:08 loliconsk 阅读(140) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; #include<algorithm> #include<vector> //二元谓词 class Mycmp { public: bool operator()(int val1, int val2) { return 阅读全文
posted @ 2021-01-16 12:17 loliconsk 阅读(138) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 14 下一页