摘要: Hat’s Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5178 Accepted Submission(s): 1934 Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find al.. 阅读全文
posted @ 2013-05-23 22:52 Dreamcaihao 阅读(224) 评论(0) 推荐(0) 编辑
摘要: What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 9488 Accepted Submission(s): 2961 Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Mart 阅读全文
posted @ 2013-05-23 21:37 Dreamcaihao 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 12855 Accepted Submission(s): 5433 Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Igna. 阅读全文
posted @ 2013-05-23 19:36 Dreamcaihao 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 一、BOOL变量flag与"零值"比较正确做法:1 if(flag)2 if(!flag)不标准做法:1 if (flag == TRUE)2 if (flag == 1 )3 if (flag == FALSE)4 if (flag == 0)二、float 变量 x 与"零值"比较正确做法:1 const float EPSINON = 0.00001;2 if ((x >= -EPSINON) && (x <= EPSINON))错误做法:1 if (x == 0.0)2 if (x != 0.0)三、char *p 与 阅读全文
posted @ 2013-05-21 22:03 Dreamcaihao 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 一、类String的原型为: 1 class String 2 { 3 public: 4 String(const char *str = NULL); //普通构造函数 5 6 ~String(void); //析构函数 7 8 String(const String &other); //拷贝构造函数 9 10 String & operator=(const String & other); //赋值函数11 12 private:13... 阅读全文
posted @ 2013-05-21 21:48 Dreamcaihao 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 一、memcpy函数的内部实现 1 void *memcpy(void *dst, const void *src, size_t _Size) 2 { 3 assert(dst != NULL && src != NULL); //判断指针是否为空 4 5 char *pDst = (char *)dst; //转换为char型指针 6 char *pSrc = (char *)src; //转换为char型指针 7 8 while(_Size--) //拷贝... 阅读全文
posted @ 2013-05-21 20:41 Dreamcaihao 阅读(477) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <WinSock2.h> 3 #pragma comment(lib, "ws2_32.lib") 4 5 int main(int argc, char **argv) 6 { 7 WSADATA wsaData; 8 WORD wVersion = MAKEWORD(2, 2); 9 if(::WSAStartup(wVersion, &wsaData) != 0) //初始化套接字库10 {11 printf("Initialize the socket ... 阅读全文
posted @ 2013-05-21 09:13 Dreamcaihao 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 一、(非递归实现) 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct _DLinkList 5 { 6 int data; 7 struct _DLinkList *prev; 8 struct _DLinkList *next; 9 10 }DLinkList; 11 12 DLinkList *CreateDLinkList(DLinkList *pHead, int array[], int n) 13 { 14 DLinkList *p = pHead; 1... 阅读全文
posted @ 2013-05-21 08:53 Dreamcaihao 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 一、单链表反转(非递归实现) 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct _LinkList 5 { 6 int data; 7 struct _LinkList *pnext; 8 9 }LinkList;10 11 12 LinkList *CreateList(LinkList *pHead, int array[], int n)13 {14 LinkList *q = pHead;15 for(int i = 0; i < n; i++)16 {17 ... 阅读全文
posted @ 2013-05-19 22:59 Dreamcaihao 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 一、基类中析构函数不加关键字virtual。 1 #include <iostream> 2 using namespace std; 3 4 class Base 5 { 6 public: 7 ~Base() 8 { 9 cout<<"Base Destructor"<<endl;10 }11 };12 13 class Derive : public Base14 {15 public:16 ~Derive()17 {18 cout<<"Derive Destructor"<<endl;1 阅读全文
posted @ 2013-05-14 23:00 Dreamcaihao 阅读(265) 评论(0) 推荐(0) 编辑