最长上升子序列 思路: 去过前面的数字小于当前数字,当前数字直接加入 否则 找到数组里面第一个>它的数字替换上 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 int n,a; 5 vector<int> ve; 6 int main() { ...
分类:
其他好文 时间:
2020-07-19 11:44:52
阅读次数:
52
C. Operation Love 先判断给定点是顺时针还是逆时针,然后再判断长度为6的边是在长度为9的边的左边还是右边即可 // Created by CAD #include <bits/stdc++.h> using namespace std; bool judge(vector<doubl ...
分类:
其他好文 时间:
2020-07-19 11:31:44
阅读次数:
76
1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 5 using namespace std; 6 7 int main() 8 { 9 vector<int> nums{1,3,4,6,5,3,2,4,7,5}; ...
分类:
编程语言 时间:
2020-07-19 00:53:48
阅读次数:
95
题目:给定3个字符串a, b, c。你的任务是判断c是否可由a, b拼接出来。 c可由a, b拼接则意味着存在一种情况,将c拆分成两个子字符串,这两个子字符串分为等于a, b。注,c在拆分过程中,c中的每个字符只能属于两个子串中的一个。 输入包含多组样例,样例数不超过20。 第一行一个整数T,表示样 ...
分类:
其他好文 时间:
2020-07-18 22:49:55
阅读次数:
88
struct BinaryTreeNode { int nvalue=0; BinaryTreeNode* pleft = nullptr; BinaryTreeNode* pright = nullptr; BinaryTreeNode* parent = nullptr;};vector<vec ...
分类:
其他好文 时间:
2020-07-18 22:37:14
阅读次数:
87
问题: 给定一组带有评分rating的士兵序列。 求从中挑出3个士兵 i, j, k (i<j<k)为一个小组,使得第 i, j, k 名士兵的 rating递增or递减。 这样的小组有多少个。 Example 1: Input: rating = [2,5,3,4,1] Output: 3 Exp ...
分类:
其他好文 时间:
2020-07-18 16:04:17
阅读次数:
67
C++基本操作 vector #####如何查找 第二维?或者第一维 【链接】对vector中的pair进行多次find操作 class isE{ isE(int val) :User(val){} bool operator()(const pair<int,int>& e)const{ retu ...
分类:
编程语言 时间:
2020-07-18 13:48:27
阅读次数:
77
链接:https://leetcode-cn.com/problems/unique-binary-search-trees/ 代码 class Solution { public: int numTrees(int n) { vector<int> f(n + 1); f[0] = 1; for ...
分类:
其他好文 时间:
2020-07-18 11:25:21
阅读次数:
56
给定一个n表示a的质因数个数。 接下来n行给出质数及其指数。 按要求输出其因数,满足如下要求: 当前数是前一个数通过乘一个质数或者除以一个质数得到。 反正就是构造嘛。对于每一个i,必然要遍历前面的所有情况。其实就是升升降降。 vector<ll> ans; vector<ll> p(16); vec ...
分类:
其他好文 时间:
2020-07-18 11:22:49
阅读次数:
70
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=5e5+10; struct node{ int cnt; node * nxt[27]; node * fail; vector<node ...
分类:
其他好文 时间:
2020-07-18 00:44:51
阅读次数:
57