摘要: 一个很重要的想法来自http://zhex.iteye.com/blog/492722提到的:3. 两个三位数的乘积肯定是一个六位数, 而这个六位回文数数P我们可以用xyzzyx的形式表示,那我们可以得到下面的公式:P = 100000x + 10000y + 1000z + 100z + 1... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(165) 评论(0) 推荐(0)
摘要: class circle{int a; // 普通变量,不能在类中初始化static int b; // 静态变量,不能在类中初始化static const int c=2; // 静态常量,可以在类中初始化static const double PI=3.1416;//error C2864... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(302) 评论(0) 推荐(0)
摘要: include include include int main(int argc, char **argv){int a = 0, b = 0, c = 0;string str;getline(cin, str);for(auto it = str.begin(); it != str.e... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(296) 评论(0) 推荐(0)
摘要: #include >#include >#include >#include >using namespace std;string make_plural(size_t ctr, const string &word, const string&ending){ return (ct... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(170) 评论(0) 推荐(0)
摘要: int main(int argc, char **argv){ int i; cout>i; autoif_equal_zero = [&]()-> bool{if (i == 0)return true;elsewhile (i > 0)--i;return false; }; cout ... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(159) 评论(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 阅读(223) 评论(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 阅读(124) 评论(0) 推荐(0)
摘要: int main (){ cout<< "Please input some numbers:" << endl;//定义输入流迭代器和尾后迭代器istream_iterator input_number_it (cin),eof;//用迭代器与尾后迭代器初始化vectorvectornumb... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(127) 评论(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 阅读(118) 评论(0) 推荐(0)
摘要: 题目:假设你有一个数组,其中的第 i 个元素代表给定的第 i 天的股票价格。如果你被允许至多完成一个交易(如,买一和卖一股票),设计一个算法找出最大的利润。解决思路:首先赋首元素的值给最小,依次向后计算利润,每次与最大值比较并保存新的最大值和新的最小值。int MaxProfit (vecto... 阅读全文
posted @ 2014-07-18 21:07 wu_overflow 阅读(175) 评论(0) 推荐(0)