#include "IPAddressValid.h"
#include
#include
using namespace std;
bool isOnePartValid(const char* cOnePartIPAddr, int len)//判断一个字段是不是合法
{
if (NULL == cOnePartIPAddr || len <= 1)
{
...
分类:
其他好文 时间:
2015-01-07 15:00:58
阅读次数:
202
输入一组数字(最多15个),去掉连续次数大于等于三的数字,如果去掉后仍有连续次数大于等于三的,继续进行同样的处理,直到结果中没有出现连续次数大于等于三的数字为止。
如果最终全部消除完了 输出“none”
输入:1 1 1 1 2 2 2 1 3 3 3 3 1 1 1
输出:none
#include
#include
using namespace std;
...
分类:
其他好文 时间:
2015-01-07 09:25:44
阅读次数:
168
题目描述:
通过键盘输入任意一个字符串序列,字符串可能包含多个子串,子串以空格分隔。请编写一个程序,自动分离出各个子串,并使用’,’将其分隔,并且在最后也补充一个’,’并将子串存储。
如果输入“abc def gh i d”,结果将是abc,def,gh,i,d,
要求实现函数:
void DivideString(const char *pInputS...
分类:
其他好文 时间:
2015-01-07 00:41:07
阅读次数:
170
题目描述:
将输入的一个单向链表,逆序后输出链表中的值。链表定义如下:
typedef struct tagListNode
{
int value;
struct tagListNode *next;
}ListNode;
要求实现函数:
void converse(ListNode **head);
【输入】head: ...
分类:
其他好文 时间:
2015-01-07 00:39:53
阅读次数:
215
将输入的字符串(字符串仅包含小写字母‘a’到‘z’),按照如下规则,循环转换后输出:a->b,b->c,…,y->z,z->a;若输入的字符串连续出现两个字母相同时,后一个字母需要连续转换2次。例如:aa 转换为 bc,zz 转换为 ab;当连续相同字母超过两个时,第三个出现的字母按第一次出现算。
要求实现函数:
void convert(char *input,char* out...
分类:
其他好文 时间:
2015-01-07 00:39:21
阅读次数:
149
#include
#include "OJ.h"
using namespace std;
/*
Description
给定一个字符串,将字符串中所有和前面重复多余的字符删除,其余字符保留,输出处理后的字符串。需要保证字符出现的先后顺序。
Prototype
int GetResult(const char *input, char *output)
I...
分类:
其他好文 时间:
2015-01-06 20:12:04
阅读次数:
140
#include
#include
#include
#include "oj.h"
int ChangeStringOnce(char *pInStr, char *pOutStr)
{
if (NULL == pInStr || NULL == pOutStr)
{
return -1;
}
int iInStrLen =0;
...
分类:
其他好文 时间:
2015-01-06 17:57:44
阅读次数:
158
#include
#include
#include "oj.h"
#include
using namespace std;
/*
功能:
输入:
输出:
返回:成功0,其它-1
*/
int ProcessString( char * strInput,char chSrc,char chDes ,char * strOutput)
{
...
分类:
其他好文 时间:
2015-01-06 15:33:34
阅读次数:
149
#include
#include
char a[]={'a','b','a','c','a','c','d','e','k','b'};
typedef char key_type;
typedef struct node{
key_type key;
struct node *next;
}node, *pnode;
void insert(pnode *root, key_type k...
分类:
其他好文 时间:
2015-01-06 11:58:17
阅读次数:
121
输入一个字符串,输出最长回文子串。当最长回文子串不止一个时,全部输出。
#include
#include
using namespace std;
#define N 100
string convert(string s)
{
string out="";
int len=s.length();
for (int i=len-1;i>=0;i--)
{
...
分类:
其他好文 时间:
2015-01-06 10:04:03
阅读次数:
134