摘要: 题目:假设你有一个数组,其中的第 i 个元素代表给定的第 i 天的股票价格。如果你被允许至多完成一个交易(如,买一和卖一股票),设计一个算法找出最大的利润。解决思路:首先赋首元素的值给最小,依次向后计算利润,每次与最大值比较并保存新的最大值和新的最小值。int MaxProfit (vecto... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(174) 评论(0) 推荐(0)
摘要: int main (int argc, char* argv[]){vectornumbers; cout numbers.begin ();)cout << *--it << " "; cout<< endl; return0;} 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(494) 评论(0) 推荐(0)
摘要: list& DeleteRepeatElements (list&lst){ lst.sort(); lst.unique(); for (conststring &each_word : lst)cout << each_word << " "; cout<< endl; returnlst... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(117) 评论(0) 推荐(0)
摘要: int main (int argc, char* argv[]){std::ios::sync_with_stdio (false); ifstreamfile; file.open(argv[1]); mapword_count; string word,line; while(getline ... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(221) 评论(0) 推荐(0)
摘要: int main (int argc, char* argv[]){std::ios::sync_with_stdio (false); vector fuck{ "fuck", "fuck", "fuck", "fuck", "fuck", "fuck","fuck", "fuck", "f... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(123) 评论(0) 推荐(0)
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Csharp{ classProgram {static ... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(219) 评论(0) 推荐(0)
摘要: 引用地址: http://blog.csdn.net/caroline_wendy题目: 写一个函数,求两个整数之和, 要求在函数体内不得使用+, -, *, /四则运算符号.不能使用运算符号,使用位运算,第一步异或运算选位,第二步与运算进位.代码:[cpp] view plaincopy#incl... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(109) 评论(0) 推荐(0)
摘要: int main (int argc, char* argv[]){std::ios::sync_with_stdio (false);//将范围从v.begin()到v.end()的元素copy到c的end()处 copy(v.begin (), v.end (), inserter (c, c.... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(362) 评论(0) 推荐(0)
摘要: #include"iostream"#define ARR_SIZE(a)(sizeof((a)) / sizeof((a[0])))int a[] = {1, 23, 32, 0, 2, 5, 23};void insert_sort(int *a, int n) { int i, j,te... 阅读全文
posted @ 2014-07-18 21:06 wu_overflow 阅读(208) 评论(0) 推荐(0)
摘要: 听说过一个关于水池和泥潭的理论,说是一个孩子扔出了一枚石子,如果丢进了水池,水池会用涟漪来积极地回应而如果扔进了泥潭,泥潭则不为所动,丝毫不去理会。什么意思呢?你或是别人可能就是那个孩子,你说出的话,或是表达出的暗示就是那枚石子,别人,或者就是你,就可能是那水池或是泥潭,你是会积极地回应呢,还... 阅读全文
posted @ 2014-07-18 21:06 wu_overflow 阅读(140) 评论(0) 推荐(0)