步骤: 1. \dot x =A*x + B*u is a state space model, with A and B are known. Now we want to locate the poles p at the desired location, so need the help with designing a controller: u= - k*x.How to choose the gain k? Answer: Substituting u= - k*x, then…
Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 12276 Accepted: 3886 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an…
求给出第 K (0 < K < 109) 个 N (0 < N < 44) 位二进制数,该二进制数不得有相邻的"1". 这道题要求给出第 K (0 < K < 109) 个 N (0 < N < 44) 位二进制数,该二进制数不得有相邻的"1".由于时间限制是 0.5 秒,肯定不能使用蛮力搜索从 1 列举到 K. 我们以 N = 5 来分析看看有没有什么规律.如左图所示,我们发现该二进制数最左边的"1&quo…
Description A substring of a string T is defined as: T( i, k)= TiTi+1... Ti+k-1, 1≤ i≤ i+k-1≤| T|. Given two strings A, B and one integer K, we define S, a set of triples (i, j, k): S = {( i, j, k) | k≥ K, A( i, k)= B( j, k)}. You are to give the val…
解题关键:模板与思路.面试题 #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<iostream> #include<cmath> #include<vector> using namespace std; typedef long long ll; //两种方式求on中位数 int partition(int…
Milk Patterns Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 16742 Accepted: 7390 Case Time Limit: 2000MS Description Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation,…
2020/4/30 15:55 树链剖分是一种十分实用的树的方法,用来处理LCA等祖先问题,以及对一棵树上的节点进行批量修改.权值和查询等有奇效. So, what is 树链剖分? 可以简单的理解为,将一棵树分成许多条不相交的链,每次我们只要得知链首,便可对该条链上所有的点用数据结构(like 线段树)进行相关操作 . 首先,介绍最常用的轻重链剖分. 明确最常用的轻重链概念: 重儿子:父亲节点的所有儿子中子树结点数目最多(size最大)的结点: 轻儿子:父亲节点中除了重儿子以外的儿子:…
Milk Patterns Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 7586 Accepted: 3448 Case Time Limit: 2000MS Description Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation,…
POJ 1741 Tree Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node…
Description It’s an interesting experience to move from ICPC to work, end my college life and start a brand new journey in company. As is known to all, every stuff in a company has a title, everyone except the boss has a direct leader, and all the re…