摘要:
1 #include 2 #include 3 4 using namespace std; 5 6 class Card { 7 private: 8 int m_SerialNumber; 9 public:10 Card(int id) : m_SerialNumber(id) {}11 ~Card() {cout(rawMemory);19 20 for (int i=0; i=0; i--) {29 cards[i].~Card();30 }31 operator... 阅读全文
摘要:
1 #include 2 #include 3 4 using namespace std; 5 6 class Base { 7 public: 8 int idx; 9 Base(int _idx=0) : idx(_idx) {}10 11 void show() {cout<<"Base"<<idx<<endl;}12 void print() {cout<<idx<<endl;}13 };14 15 class Derive : public Base {16 public:17... 阅读全文
摘要:
1 class Solution { 2 public: 3 bool searchMatrix(vector > &matrix, int target) { 4 int rows, cols; 5 if (!(rows = matrix.size()) || !(cols = matrix[0].size())) return false; 6 int ridx, cur, first = -1, last = rows; 7 while (first + 1 target) {13 ... 阅读全文
摘要:
1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 if (n <= 2) return n; 5 int wpos = 1; 6 int dups = 0; 7 int cur, last = A[0]; 8 9 for (int i=1; i<n; i++) {10 cur = A[i];11 dups = (cur == last) ? dup... 阅读全文