上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 43 下一页
摘要: https://www.hackerrank.com/contests/w6/challenges/acm-icpc-team这道题在contest的时候数据量改小过,原来的数据量需要进行优化才能过。参考了:http://chasethered.com/2014/07/hackerrank-week... 阅读全文
posted @ 2014-08-12 23:58 阿牧遥 阅读(311) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/w7/challenges/chocolate-in-boxNim Game:http://www.cdf.toronto.edu/~ajr/270/probsess/03/strategy.html策略是将数组变成XOR为0的... 阅读全文
posted @ 2014-08-12 18:17 阿牧遥 阅读(286) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/w7/challenges/die-hard-3首先,发现c #include using namespace std;int gcd(int a, int b) { if (a % b == 0) { return b; }... 阅读全文
posted @ 2014-08-12 10:47 阿牧遥 阅读(182) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/w8/challenges/gneck有点意思。是DP,最优解包含最优子问题。F(X)=F(X-1)+F(X-3)。因为F(X-1)右边放个“R”和F(X-3)右边放"RRB"是左右可以互推的,包含全了最右是R和B的两种情况。#... 阅读全文
posted @ 2014-08-11 20:16 阿牧遥 阅读(219) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/w8/challenges/john-and-gcd-list简单题,GCD和LCM。#include #include using namespace std;int gcd(int a, int b) { if (a % b... 阅读全文
posted @ 2014-08-11 13:46 阿牧遥 阅读(194) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/w8/challenges/counter-game关键是二分查找等于或最接近的小于target的数。可以使用和mid+1判断来比较~ 另有一种做法如下:http://stackoverflow.com/questions/65... 阅读全文
posted @ 2014-08-11 12:05 阿牧遥 阅读(376) 评论(0) 推荐(0) 编辑
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=12975简单题#include #include using namespace std;class EllysNumberGuessing {public: int getNumb... 阅读全文
posted @ 2014-08-10 17:55 阿牧遥 阅读(156) 评论(0) 推荐(0) 编辑
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=12967计算一个字符串里Palindrome的数量。我的DP方法需要n^2的空间。#include #include using namespace std;class Palind... 阅读全文
posted @ 2014-08-09 21:05 阿牧遥 阅读(134) 评论(0) 推荐(0) 编辑
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=12995简单题class PackingBallsDiv2 {public: int minPacks(int R, int G, int B) { int sum = 0; s... 阅读全文
posted @ 2014-08-09 20:33 阿牧遥 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=13035矩阵棋盘的题,比较典型。可以定两条column夹住,然后上下扫,上下扫过程中有一点DP的东西,这样负责度是o(n^3)#include #include #include u... 阅读全文
posted @ 2014-08-09 12:59 阿牧遥 阅读(192) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 43 下一页