随笔分类 - mooc.程序设计与算法(三)
摘要:1 #include <iostream> 2 #include <map> 3 #include <cstdio> 4 #include <cmath> 5 using namespace std; 6 7 //key:实力值power value:id号 8 int main(){ 9 map<
阅读全文
摘要:#include <iostream> #include <map> #include <cstdio> #include <cmath> using namespace std; //key:实力值power value:id号 int main(){ map<int,int> members;
阅读全文
摘要:1 #include <iostream> 2 #include <set> 3 #include <cstdio> 4 using namespace std; 5 bool wasAdd[100001]; 6 7 int main(){ 8 multiset<int> mset; 9 int n
阅读全文
摘要:1 #include <iostream> 2 #include <list> 3 #include <string> 4 #include <cstdio> 5 using namespace std; 6 const int N = 10001; 7 8 int main() 9 { 10 in
阅读全文
摘要:#include <iostream> #include <list> #include <string> using namespace std; template <class T1,class T2> void Copy(T1 s,T1 e, T2 x) { for(; s != e; ++s
阅读全文
摘要:#include <cstdio> #include <iostream> #include <algorithm> #include <list> using namespace std; int main() { double a[] = {1.2,3.4,9.8,7.3,2.6}; list<
阅读全文
摘要:1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 5 6 struct A { 7 int v; 8 A() { } 9 A(int n):v(n) { }; 10 bool operator<(const A &
阅读全文
摘要:1 #include <iostream> 2 #include <cmath> 3 #include <algorithm> 4 #include <string> 5 using namespace std; 6 template <class T1,class T2> 7 struct Clo
阅读全文
摘要:1 #include <iostream> 2 using namespace std; 3 4 bool Greater2(int n1,int n2) 5 { 6 return n1 > n2; 7 } 8 bool Greater1(int n1,int n2) 9 { 10 return n
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 4 using namespace std; 5 template <class T> 6 class CMyistream_iterator 7 { 8 private: 9 istream& in; 10 T
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 #include <cstring> 4 using namespace std; 5 template <class T> 6 class myclass { 7 private: 8 T* p; 9 int
阅读全文
摘要:1 #include <iostream> 2 using namespace std; 3 class MyCin 4 { 5 bool value; 6 public: 7 MyCin():value(true){ } 8 operator bool(){return value;} 9 MyC
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 using namespace std; 4 template<class T,class Pred> 5 T* Filter(T* p,T* q,T* s,Pred op){ 6 while(p < q){ 7
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 using namespace std; 4 template<class T,class Pred> 5 void MyForeach(T *p,T *q,Pred op){ 6 while(p != q){
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 using namespace std; 4 template <class T> 5 T SumArray( 6 T *p,T *q){ 7 T sum = *p; 8 while(++ p != q) 9 s
阅读全文
摘要:1 #include <iostream> 2 using namespace std; 3 class A { 4 private: 5 int nVal; 6 public: 7 void Fun() 8 { cout << "A::Fun" << endl; }; 9 virtual void
阅读全文
摘要:1 #include <iostream> 2 using namespace std; 3 class A 4 { 5 public: 6 A() { } 7 virtual ~A() { cout << "destructor A" << endl; } 8 }; 9 class B:publi
阅读全文
摘要:1 #include <iostream> 2 using namespace std; 3 class B { 4 private: 5 int nBVal; 6 public: 7 void Print() 8 { cout << "nBVal="<< nBVal << endl; } 9 vo
阅读全文
摘要:1 #include <cstdlib> 2 #include <iostream> 3 using namespace std; 4 int strlen(const char * s) 5 { int i = 0; 6 for(; s[i]; ++i); 7 return i; 8 } 9 vo
阅读全文
摘要:1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 using namespace std; 6 const int MAX = 110; 7 class CHugeInt { 8
阅读全文