摘要:
转载自:click here 对于动态规划,每个刚接触的人都需要一段时间来理解,特别是第一次接触的时候总是想不通为什么这种方法可行,这篇文章就是为了帮助大家理解动态规划,并通过讲解基本的01背包问题来引导读者如何去思考动态规划。本文力求通俗易懂,无异性,不让读者感到迷惑,引导读者去思考,所以如果你在 阅读全文
摘要:
转载自:Click Here LCA问题(Lowest Common Ancestors,最近公共祖先问题),是指给定一棵有根树T,给出若干个查询LCA(u, v)(通常查询数量较大),每次求树T中两个顶点u和v的最近公共祖先,即找一个节点,同时是u和v的祖先,并且深度尽可能大(尽可能远离树根)。L 阅读全文
摘要:
传送门 Description You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of 阅读全文
摘要:
传送门 Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 24513 Accepted: 10227 Description An earthquake takes place in Southe 阅读全文
摘要:
``` int find_kth(int k) { int ans = 0,cnt = 0; for (int i = 20;i = 0;i ) //这里的20适当的取值,与MAX_VAL有关,一般取lg(MAX_VAL) { ans += (1 = maxn || cnt + c[ans] = k 阅读全文