上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页
摘要: 一、DFS实现N皇后 1 #include<bits/stdc++.h> 2 using namespace std; 3 int ans[10];//用于存放答案 4 int tot;//方案数 5 const int n=8;//N皇后问题 6 bool check(int c, int r){ 阅读全文
posted @ 2020-09-17 23:32 TFLSNOI 阅读(253) 评论(0) 推荐(0)
摘要: 题目链接:https://blog.csdn.net/wly_2014/article/details/51388263 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn=64; 4 int n, matchlist[ 阅读全文
posted @ 2020-08-22 11:19 TFLSNOI 阅读(158) 评论(0) 推荐(0)
摘要: 一、归并排序 核心思想:就是采用了经典的分治策略(分治法将问题分(divide)成一些小的问题,然后递归求解,而治(conquer)的阶段则将分的阶段得到的各答案“修补”在一起,即分而治之) 思路分析:对于"分"的阶段:我们只要找到数组的中间下标mid,然后将下标值小于等于mid的元素分成一个子数组 阅读全文
posted @ 2020-08-22 11:03 TFLSNOI 阅读(617) 评论(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 阅读(439) 评论(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 阅读(189) 评论(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 阅读(168) 评论(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 阅读(214) 评论(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 阅读(193) 评论(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 阅读(371) 评论(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 阅读(216) 评论(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 阅读(255) 评论(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 阅读(353) 评论(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 阅读(216) 评论(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 阅读(223) 评论(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 阅读(257) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页