随笔分类 -  ACM~~ 动态规划

摘要:此题主要考查的是求最长公共子序列设A[i]:A[j] = a:b = ac:bc B[ii]:B[jj] = c:d = ac:ad ,如果A[i]:A[j] = B[ii]:B[jj]则bc= ad,所以A乘以B的倍数,B乘以A的倍数,则A与B所求的序列必然是一样的,即求A与B的最长公共子序列 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 class AstronomicalRecordsEasy{ 8 public: 9 int minimalPlanets(vector A, vecto... 阅读全文
posted @ 2013-10-19 21:21 OpenSoucre 阅读(243) 评论(0) 推荐(0)
摘要:1017. StaircasesTime limit: 1.0 secondMemory limit: 64 MBOne curious child has a set ofNlittle bricks (5 ≤N≤ 500). From these bricks he builds different staircases. Staircase consists of steps of different sizes in a strictly descending order. It is not allowed for staircase to have steps equal size 阅读全文
posted @ 2013-05-09 10:06 OpenSoucre 阅读(673) 评论(0) 推荐(0)
摘要:1009. K-based NumbersTime Limit: 1.0 secondMemory Limit: 64 MBLet’s consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation doesn’t contain two successive zeros. For example:1010230 is a valid 7-digit number;1000198 is not a valid number;0001235 阅读全文
posted @ 2013-04-22 11:00 OpenSoucre 阅读(393) 评论(0) 推荐(0)