原创 從序列裏條N個數,使其和等於M

/* 問題描述: 從一個序列裏面取N個數,使N個數的和爲M ,找出這樣的序列 */ #include <iostream> using namespace std; int cnt = 2; int target = 9; int co

原创 C++ STL源碼分析之 list

STL中list與其他順序容器實現不同因此不支持一部分容器操作,注:forward_list 有自己特有的insert 和emplace,vetor和string不支持push_front和emplace_front STL的list是一

原创 原碼VS補碼 (對於有符號數而言)

原碼的表示思想是最高位爲符號位,其餘位爲絕對值。 假設某類型有8位,X7 X6 X5 X4 X3 X2 X1 X0 最大正數 0 111 1111  +127 最小負數 1 111 1111  -128 (數值位爲2^7 -128

原创 python 整數越界問題詳解

這篇文章主要介紹了python 整數越界問題詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨着小編來一起學習學習吧 python 內部自帶大整數運算能力,整數運算

原创 BP神經網絡的數學原理及其算法實現

轉自http://blog.csdn.net/zhongkejingwang/article/details/44514073 BP網絡的數學原理   下面將介紹BP網絡的數學原理,相比起SVD的算法推導,這個簡直就是小菜一碟,

原创 17年微軟筆試題

#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> using namesp

原创 c++ erase 會使迭代器失效

因爲erase函數會真正刪除元素,導致後面的元素前移,因此後面的迭代器失效(不能引用到正確的結果)所以每次執行完erase操作之後,後面的迭代器都會失效,看看下main的代碼:int removeDupl

原创 17 年頭條筆試

#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> using namesp

原创 17 商湯筆試2

/* * 題目描述: 求最長遞增序列 * 輸入 :n 和n個整數 * 輸出 : 整數n 代表最長遞增序列 * sample input : 3 1 6 5 * sample output : 2 * 思路: 對序列每一位置維護一個變量

原创 c++ 變量不要定義在.h 頭文件當中(main already defined in *.obj 解決方法)

原文地址:http://blog.csdn.NET/tianwailaibin/article/details/6239380 原博客地址:http://blog.csdn.net/u010536615/article/details/5

原创 輸出二叉樹每層節點數量

/* 輸出二叉樹每層的節點*/ typedef struct node{ struct node* left; struct node* right; node(){ left = NULL; right = NULL;

原创 左移運算符 優先級很低

寫了一個大小端轉換的代碼 int x =recv(sockConn, (char*)buf, len, 0); cout << "data read:" << x << endl; for(int i = 0; i < 30;

原创 c++ shared_ptr使用的幾點注意

先介紹一下shared_ptr.是c++爲了提高指針安全性而添加的智能指針,方便了內存管理。功能非常強大,非常強大,非常強大(不單單是shared_ptr,配合week_ptr以及enable_share_from_this()以及sha

原创 17年商湯筆試題

#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> using namesp

原创 c++ 文件操作 fs.read 讀出的字符數量不對,0x1A 在搞怪

  需要用c++ 代碼讀取一幀圖像的內容,圖像大小爲1368*768*4 = 4202496 代碼如下: char* buf = new char[4202496]; ifstream fs("1.data"); fs.read(b