2019年10月20日

摘要: 前中后序的相互转换只需要考虑对应的子树是否存在节点即可,有中序的顺序判断子树关系,由前(开始为根)或后(末尾为根)序遍历判断当前子树的根是哪个节点; 阅读全文
posted @ 2019-10-20 21:20 等下一班车 阅读(129) 评论(0) 推荐(0) 编辑
 
摘要: Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that 阅读全文
posted @ 2019-10-20 10:17 等下一班车 阅读(164) 评论(0) 推荐(0) 编辑

2019年10月19日

摘要: In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing su 阅读全文
posted @ 2019-10-19 10:05 等下一班车 阅读(179) 评论(0) 推荐(0) 编辑

2019年10月17日

摘要: #include<iostream> #include<sstream>#include<string>using namespace std;int n;bool judge(string s){ long long t1, t2, t3; stringstream ss; /*ss.clear( 阅读全文
posted @ 2019-10-17 15:14 等下一班车 阅读(88) 评论(0) 推荐(0) 编辑

2019年10月15日

摘要: #include <iostream>#include <vector>using namespace std;int main() { int n, m, k, nv, a, b, num; scanf("%d%d", &n, &m); vector<int> v[n]; for (int i = 阅读全文
posted @ 2019-10-15 20:41 等下一班车 阅读(114) 评论(0) 推荐(0) 编辑
 
摘要: #include<iostream>#include<string>#include<algorithm>using namespace std;string rev(string s){ reverse(s.begin(), s.end()); return s;}string add(strin 阅读全文
posted @ 2019-10-15 16:29 等下一班车 阅读(222) 评论(0) 推荐(0) 编辑

2019年10月11日

摘要: After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the rank 阅读全文
posted @ 2019-10-11 16:24 等下一班车 阅读(193) 评论(0) 推荐(0) 编辑

2019年10月10日

摘要: #include<iostream> #include<stdio.h> #include<vector> #include<algorithm> #include<time.h> #include<set> #pragma warning(disable:4996) using namespace std; struct coordinate { int x, y; }; bool cmp_x( 阅读全文
posted @ 2019-10-10 20:27 等下一班车 阅读(169) 评论(0) 推荐(0) 编辑
 
摘要: This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed grap 阅读全文
posted @ 2019-10-10 08:42 等下一班车 阅读(182) 评论(0) 推荐(0) 编辑

2019年10月9日

摘要: The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin 阅读全文
posted @ 2019-10-09 13:37 等下一班车 阅读(154) 评论(0) 推荐(0) 编辑