随笔分类 - POJ
摘要:题意:给一个括号序列,要求把这个括号序列变成全部匹配的序列,要求补充的括号字符最少题解:这道题是区间DP,我们考虑这样一个状态,F[ i ][ j ] 表示把 i 到 j 这一段完全匹配所要添加的最小括号数,在每拓展到下一位时,有两种情况:1、这个新的符号无法和前面的任何一个匹配,只能添加一个新的符...
阅读全文
摘要:题意:一个字母序列长度为 m ,由 n 个字母组成,每个字母有两个花费:① 删掉这个字母;② 加上这个字母。问把这个序列变成一个回文序列的最小花费。题解:F[ i ][ j ] 表示 i - j 这一段变成回文串的最小花费。 当序列 s[ i ] == s[ j ] 时,不需要任何花费:F[ i...
阅读全文
摘要:题意:就是数有一个字符串中有多少括号匹配:① ()算两种,② [ ] 算两种题解: 和 LightOj 那道题一样 F[ i ][ j ] = max(F[ i + 1][ j ], F[ i + 1][ k - 1] + F[ k ][ j ] + 2) {i + 1 #include #de...
阅读全文
摘要:DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10530Accepted: 7484DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 6803Accepted: 3705DescriptionYou are assigned to design network connections between certain p...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3949Accepted: 2375DescriptionAfter Farmer John realized that Bessie had installed a "tree-sha...
阅读全文
摘要:Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 5154Accepted: 1793DescriptionLast years Chicago was full of gangster fights and strange murde...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10229Accepted: 4221DescriptionConsider a tree T with N (1 #include #include #define REP(i, s,...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 11782Accepted: 3290DescriptionN gangsters are going to a restaurant. The i-th gangster comes ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4995Accepted: 2824DescriptionThere is going to be a party to celebrate the 80-th Anniversary ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 17960Accepted: 12592DescriptionBill and Ted are taking a road trip. But the odometer in their...
阅读全文
摘要:Time Limit: 5000MSMemory Limit: 65536KTotal Submissions: 26629Accepted: 13096DescriptionThere are so many different religions in the world today that ...
阅读全文
摘要:Time Limit: 10000MSMemory Limit: 65536KTotal Submissions: 18146Accepted: 7660DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Coo...
阅读全文
摘要:Time Limit: 10000MSMemory Limit: 65536KTotal Submissions: 30184Accepted: 9886DescriptionBackground Professor Hopper is researching the sexual behavior...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 34672Accepted: 10691DescriptionThe police office in Tadu City decides to say ends to the chao...
阅读全文
摘要:Time Limit: 12000MSMemory Limit: 65536KTotal Submissions: 43129Accepted: 12740Case Time Limit: 5000MSDescriptionAn array of size n ≤ 106 is given to y...
阅读全文
摘要:Time Limit: 5000MSMemory Limit: 65536KTotal Submissions: 38139Accepted: 17863Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 9679Accepted: 5420DescriptionOver the years, the people of the great city of Pittsburgh have ...
阅读全文
摘要:Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6434Accepted: 3324DescriptionSimulate a locked spinner puzzle. A locked spinner puzzle is a p...
阅读全文