摘要: https://oj.leetcode.com/problems/reverse-words-in-a-string/分三步,1. reverse line; 2. reverse words; 3. erase extra spaces;class Solution {public: voi... 阅读全文
posted @ 2014-08-02 20:14 阿牧遥 阅读(178) 评论(0) 推荐(0)
摘要: https://www.topcoder.com/stat?c=problem_statement&pm=13146&rd=15852// Need carefully calc the shift and the final index#include using namespace std;cl... 阅读全文
posted @ 2014-08-02 17:39 阿牧遥 阅读(172) 评论(0) 推荐(0)
摘要: C++优先队列类似队列,但是在这个数据结构中的元素按照一定的断言排列有序。它的头文件为。由于适配器不支持迭代,一个 priority_queue 将有没有关联的迭代器。函数列表:empty() 如果优先队列为空,则返回真 pop() 删除第一个元素 push() 加入一个元素 size() 返回优先... 阅读全文
posted @ 2014-08-02 15:54 阿牧遥 阅读(229) 评论(0) 推荐(0)
摘要: https://community.topcoder.com/stat?c=problem_statement&pm=13192#include #include #include using namespace std;class BoxesDiv2{public: vector power2; ... 阅读全文
posted @ 2014-08-02 15:53 阿牧遥 阅读(186) 评论(0) 推荐(0)
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=12107此题想了半天,当时瞥到了Greedy,所以就想着贪心,最后的方法又纸上画了一下应该是对的。就是排序后依次看是不是满足要求。证明就是如果对数字X,有a和b都能够通过增加k的倍数... 阅读全文
posted @ 2014-08-02 08:33 阿牧遥 阅读(344) 评论(0) 推荐(0)
摘要: http://community.topcoder.com/stat?c=problem_statement&pm=13245就是有字符串,里面的字符可以随意两两消除,如果不等的话,那么最后如果留下一个字符,这个字符就是winning letter。如果任意方法消除都是这个winning lette... 阅读全文
posted @ 2014-08-02 07:50 阿牧遥 阅读(199) 评论(0) 推荐(0)