惯例,8月总版第一,散分。

傻X 2012-09-02 04:27:44
好事多磨,经历删除专家分等种种困难,最终还是拿到了总版第一。感谢大家支持,特别鸣谢11大版,鹦鹉大版,及广大好友的鼎力支持。谢谢。

PS:特邀agoago_2009来谈谈,一月拿三牌的心得
...全文
502 63 打赏 收藏 转发到动态 举报
写回复
用AI写文章
63 条回复
切换为时间正序
请发表友善的回复…
发表回复
xzhdy 2012-11-06
  • 打赏
  • 举报
回复
G恭喜楼主,到处都能看见你的身影,膜拜一下
ryfdizuo 2012-11-06
  • 打赏
  • 举报
回复
顶一个,哈哈~
工程师123123123 2012-10-29
  • 打赏
  • 举报
回复
围观,惊叹中。。
lambition 2012-09-19
  • 打赏
  • 举报
回复
强势围观!
Wentasy 2012-09-14
  • 打赏
  • 举报
回复
强势围观!
傻X 2012-09-14
  • 打赏
  • 举报
回复

#include <stdio.h>
#include <string.h>
#include <vector>
#include <list>
#include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
typedef basic_string<char>::size_type S_T;
/******************************************************************************
******************************************************************************
File Name :
Version :
Author :
Created : 2011/9
Last Modified :
Description :
Function List :

History :
1.Date : 2011/9
Author :
Modification: Created file

******************************************************************************/

int iMyListCount = 0;

struct MyList
{
int index;
string strDominName;
std::queue<string> ListSonDomin;
};

std::list<MyList> m_list;

int add_SonDomin(MyList &myList);
bool MySort(const MyList &list1, const MyList &list2); //排序方法

bool MySort(const MyList &list1, const MyList &list2) //排序方法
{
std::queue<string> tempList1;
std::queue<string> tempList2;
const char * chList1;
const char * chList2;

tempList1 = list1.ListSonDomin;
tempList2 = list2.ListSonDomin;

while((!tempList1.empty()) && (!tempList2.empty()))
{
chList1 = tempList1.front().c_str();
chList2 = tempList2.front().c_str();

while(*chList1 == *chList2)
{
chList1++;
chList2++;
}

if((*chList1) < (*chList2))
{
return true; //tempList1 排在前
}
else
{
return false; //tempList2 排在后
}

tempList1.pop();
tempList2.pop();
}

if(tempList1.empty())
{
return true; //tempList1排在前
}

if(tempList2.empty())
{
return false;
}

}


int add_SonDomin(MyList &myList)
{
S_T ulStartIndex = 0;
S_T ulFindIndex = 0;
S_T len = 0;
bool bGo = true;
do
{
ulFindIndex = myList.strDominName.find('.',ulStartIndex);
if(ulFindIndex == string::npos)
{
bGo = false;
}


len = ulFindIndex - ulStartIndex;
if(len < 0)
{
cout<<"ulFindIndex is error, please check out"<<endl;
return -1;
}

myList.ListSonDomin.push(myList.strDominName.substr(ulStartIndex,len));
ulStartIndex = ulFindIndex+1;



} while (bGo);


return 0;
}
/*****************************************************************************
Description : 添加主机名
Input Param : host_name 主机名字符串,非空串
Output Param : 无
Return Value : 成功返回0,失败返回-1
*****************************************************************************/
int add_host_name(const char* host_name)
{

/* 在这里实现功能 */
MyList tempList;
tempList.index = iMyListCount;
tempList.strDominName = host_name;
add_SonDomin(tempList);
m_list.push_back(tempList);
//cout<<tempList.strDominName.c_str()<<endl;
//tempList.strDominName.fin
//string::npos;
return 0;
}

/*****************************************************************************
Description : 获取主机名
Input Param : serial_number 排序后的序列号,从1开始
host_name_max_length host_name的最大长度,包括'\0'
Output Param : host_name 主机名字符串,必须包括’\0’,内存由调用者分配和释放
Return Value : 成功返回0,失败返回-1(如:serial_number超出范围、最大长度不够)
*****************************************************************************/
int get_host_name(int serial_number, int host_name_max_length, char* host_name)
{
/* 在这里实现功能 */
m_list.sort(MySort);
if(m_list.size() < serial_number)
{
return -1;
}

list<MyList>::iterator my_iter = m_list.begin();
list<MyList>::iterator iter_end = m_list.end();
int i = 0;

while(i<serial_number)
{
my_iter++;
i++;
}

memcpy(host_name,(const char *)*my_iter->strDominName.c_str(),host_name_max_length);
*(host_name + host_name_max_length) = '\0';

return 0;
}

/*****************************************************************************
Description : 清空所有主机名
Input Param : 无
Output Param : 无
Return Value : 无
*****************************************************************************/
void clear(void)
{
m_list.clear();
/* 在这里实现功能 */
}


yuhaoyang2012 2012-09-10
  • 打赏
  • 举报
回复
怎么散分从来都赶不上趟呢
向立天 2012-09-04
  • 打赏
  • 举报
回复
好久不来了
看来月榜格局又有变化了
傻X 2012-09-03
  • 打赏
  • 举报
回复
[Quote=引用 27 楼 的回复:]
引用 23 楼 的回复:
拿了多少分啊全版第一?

12K多...
我算了算,平均每天要拿400多分

LZ,你丫是不是开挂了?!
[/Quote]

其实还少算1200分那,早上管理员跟我说了。
gibsonboy 2012-09-03
  • 打赏
  • 举报
回复
呵呵!恭喜!CSDN需要这样的人才!
daniel__ 2012-09-03
  • 打赏
  • 举报
回复
大能皆是大毅力者
sms88 2012-09-03
  • 打赏
  • 举报
回复
恭喜 啊
mukedian0 2012-09-03
  • 打赏
  • 举报
回复
GOOD
幸福官 2012-09-03
  • 打赏
  • 举报
回复
恭喜恭喜
ouyh12345 2012-09-03
  • 打赏
  • 举报
回复
zgl7903 2012-09-03
  • 打赏
  • 举报
回复
alexander_david 2012-09-03
  • 打赏
  • 举报
回复
dahaiI0 2012-09-03
  • 打赏
  • 举报
回复
恭喜。。
feilongjilei 2012-09-03
  • 打赏
  • 举报
回复
hdg3707 2012-09-03
  • 打赏
  • 举报
回复
支持楼主,互相学习,互相交流
加载更多回复(43)

1,649

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧