题目链接:小猫爬山 解法一: #include<iostream> #include<algorithm> using namespace std; const int N = 20; int n,m; int cat[N],sum[N]; int ans=N; void dfs(int now,i ...
分类:
编程语言 时间:
2020-06-26 10:50:34
阅读次数:
99
#include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<iostream> using namespace std; const int maxn=200010; const double eps ...
分类:
其他好文 时间:
2020-06-25 19:49:59
阅读次数:
64
1.介绍 排序是将一组数据,以指定的顺序进行排序的过程 2.分类 内部排序法:指将需要处理的所有数据都加载到内部存储器中进行排序 外部排序法:数据量过大,无法全部加载到内存中,需要借助外部存储进行排序 ...
分类:
编程语言 时间:
2020-06-25 15:25:37
阅读次数:
54
1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 using namespace std; 5 bool cmp(int a, int b) { 6 return a > b; 7 } 8 int main() { ...
分类:
其他好文 时间:
2020-06-25 09:46:47
阅读次数:
57
Buggy Robot 思路:dp[inx][x][y],表示用了前inx个指令后的最小费用。 对于一个指令,我们可以选择不走或者走,其他的我们可以添加四个方向的指令与使用过指令后的dp来比较。 1 #include <iostream> 2 #include <algorithm> 3 #incl ...
分类:
其他好文 时间:
2020-06-24 16:11:34
阅读次数:
35
传统方法:遍历每一个字符,以该字符为中点向两边查找。 问题1: 由于回文串长度的奇偶性,需要对对称轴的位置进行分别判断,这种解法的时间复杂度是O(n^2)。 如aabb对称轴为ab之间,而ababa对称轴为中间的a 需要分别对两种情况进行判断 问题2:子串被重复多次访问,降低了时间效率。 Manac ...
分类:
其他好文 时间:
2020-06-24 15:50:57
阅读次数:
51
#include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<iostream> using namespace std; const int maxn=1e6+10; const int inf=0x ...
分类:
其他好文 时间:
2020-06-24 12:05:43
阅读次数:
37
max()/min()/abs()函数 swap()函数 reverse()函数 next_permutation()函数 fill()函数 sort()函数 头文件需要 #include<algorithm> using namespace std 使用方法 sort(首元素地址(必填), 尾元素 ...
分类:
其他好文 时间:
2020-06-23 21:43:03
阅读次数:
58
Tinyrender-Lesson 1 Bresenham’s Line Drawing Algorithm 原文:https://github.com/ssloy/tinyrenderer/wiki/Lesson-1-Bresenham%E2%80%99s-Line-Drawing-Algorit ...
1.数据结构概述数据结构(Data Structure是一门和计算机硬件与软件都密切相关的学科,它的研究重点是在计算机的程序设计领域中探讨如何在计算机中组织和存储数据并进行高效率的运用,涉及的内容包含:数据的逻辑关系、数据的存储结构、排序算法(Algorithm)、查找(或搜索)等。 2.数据结构与 ...
分类:
编程语言 时间:
2020-06-23 20:58:33
阅读次数:
59