摘要:
第一题是整数的方阵,求其中的子方阵,和最大。返回最大和以及子方阵宽度。因为做了topcoder的题,所以比较顺手,O(n^3)的复杂度。pair maxiSum(vector > &a) { //first is n second is sum int N = a.size(); in... 阅读全文
posted @ 2014-08-08 22:50
阿牧遥
阅读(293)
评论(0)
推荐(0)
摘要:
http://community.topcoder.com/stat?c=problem_statement&pm=13005好题。最暴力是试验2^n种跳法。然后有从结果入手,那么最终的左右是i, j,有n^2种(每种4个跳法),然后花O(n)的时间去验证。最后的正解比较有意思,就是观察到必须向里跳... 阅读全文
posted @ 2014-08-08 17:14
阿牧遥
阅读(192)
评论(0)
推荐(0)
摘要:
http://community.topcoder.com/stat?c=problem_statement&pm=13040DFS集合全排列+LCM和GCD。但事实上,有更简单的算法,列在下面,就是观察到不能整除x的对我们无效。#include #include using namespace s... 阅读全文
posted @ 2014-08-08 15:23
阿牧遥
阅读(150)
评论(0)
推荐(0)
摘要:
http://community.topcoder.com/stat?c=problem_statement&pm=13091解方程,对中国孩子太简单了。#include #include using namespace std;class LongLongTripDiv2 {public: ... 阅读全文
posted @ 2014-08-08 14:48
阿牧遥
阅读(147)
评论(0)
推荐(0)
摘要:
http://community.topcoder.com/stat?c=problem_statement&pm=13147此题关键在于发现ABAB的组合最多有26*26种,可以穷举,然后用判断子序列~#include #include using namespace std;class Long... 阅读全文
posted @ 2014-08-08 14:29
阿牧遥
阅读(135)
评论(0)
推荐(0)

浙公网安备 33010602011771号