上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页
摘要: 一、归并排序 核心思想:就是采用了经典的分治策略(分治法将问题分(divide)成一些小的问题,然后递归求解,而治(conquer)的阶段则将分的阶段得到的各答案“修补”在一起,即分而治之) 思路分析:对于"分"的阶段:我们只要找到数组的中间下标mid,然后将下标值小于等于mid的元素分成一个子数组 阅读全文
posted @ 2020-08-22 11:03 TFLSNOI 阅读(559) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://www.luogu.com.cn/problem/P1106 问题分析:根据贪心策略,可找到导致字符串不上升的数字往前移一位即可,依次删除 1 #include<bits/stdc++.h> 2 using namespace std; 3 char n[250]; 4 in 阅读全文
posted @ 2020-08-18 18:05 TFLSNOI 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 const int maxn=1010; 5 struct node{ //point即指针,data就是需要维护的数据 6 int point,data; 7 }a[maxn]; 8 int 阅读全文
posted @ 2020-08-18 11:07 TFLSNOI 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P1002 1 #include<bits/stdc++.h> 2 using namespace std; 3 int bx, by, mx, my; 4 long long f[25][25]; //f[x][y]表示从 阅读全文
posted @ 2020-08-13 17:50 TFLSNOI 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目链接https://www.luogu.com.cn/problem/P3613 1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 const int MAX = 100005; 5 struct node 6 阅读全文
posted @ 2020-08-13 10:57 TFLSNOI 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 题目连接 https://www.luogu.com.cn/problem/P3156 方法一: 数组写法 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, m, q; 4 int a[2000005]; 5 int main() 6 阅读全文
posted @ 2020-08-12 22:38 TFLSNOI 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接https://www.luogu.com.cn/problem/P4715 根据满二叉树的性质: 1.满二叉树外观上是一个三角形2.一个层数为k 的满二叉树总结点数为:2^k-1 (因此满二叉树的结点树一定是奇数个)3.第i层上的结点数为:2^(k-1)4.一个层数为k的满二叉树的叶子结点 阅读全文
posted @ 2020-08-12 21:07 TFLSNOI 阅读(306) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P4913 #include<bits/stdc++.h> using namespace std; struct node{ int l, r; }; node a[1000005]; int n, ans=-1; void dfs 阅读全文
posted @ 2020-08-12 17:31 TFLSNOI 阅读(204) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1478 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, s, a, b; 4 struct apple{ //结构体定义苹果的高度和摘苹果所用的力气 5 int 阅读全文
posted @ 2020-07-23 11:43 TFLSNOI 阅读(223) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1223 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n; 4 struct t{ //定义结构体存放等待时间和排队编号 5 int w, no; 6 }; 7 t 阅读全文
posted @ 2020-07-22 18:20 TFLSNOI 阅读(343) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2240 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, t; 4 struct jb{ //金币结构体 5 int m, v;//重量,价值 6 }; 7 jb 阅读全文
posted @ 2020-07-22 17:56 TFLSNOI 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 全排列递归写法 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, m; 4 int a[100]; 5 bool vis[100]; 6 void dfs(int x) 7 { 8 if(x>n){ 9 for(int i=1; i< 阅读全文
posted @ 2020-07-17 16:54 TFLSNOI 阅读(208) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1036 方法一:递归回溯+素数判断 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, k, ans=0; 4 int x[25], a[25]; 5 bool vi 阅读全文
posted @ 2020-07-14 23:22 TFLSNOI 阅读(226) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1618 1 #include<bits/stdc++.h> 2 using namespace std; 3 int a, b, c; 4 int dic[10]; //用于判断是否1-9每个数都出现过 5 bool check1 阅读全文
posted @ 2020-07-14 17:09 TFLSNOI 阅读(204) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2089 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, cnt=0, ans[60000][10]; 4 //最多情况是3^10= 59049,所以开60000二 阅读全文
posted @ 2020-07-14 14:53 TFLSNOI 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页