Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¹ØÓÚ×Ö·û´®µÄCÃæÊÔÌâ

¸øÒ»¸ö×Ö·û´®¡¢ÀýÈç ¡°ababc¡±ÒªÇ󷵻ء°ab¡±. ÒòΪ¡°ab¡±Á¬ÐøÖظ´³öÏÖÇÒ×¡£  ÓÃC/C£«£«ÓïÑÔдһº¯ÊýÍê³É¸ÃËã·¨£¬¸ø³ö¸´ÔÓ¶È
Õâ¸öÌâÎÒ²»»á

C/C++ code:

#include <iostream>
#include <string>

using namespace std;

bool getmaxsubstr(const string& s, string& oks);

int main()
{
string str;

while (cin >> str)
{
string s;
if (getmaxsubstr(str, s))
{
cout << s << endl;
}
else
{
cout << "do not exist!\n";
}
}

return 0;
}

bool getmaxsubstr(const string& s, string& oks)
{
string rets;
int len = 0;
bool bf = false;
for (int i = 0; i < s.size(); ++i)
{
for (int j = 1; j <= s.size() - i; ++j)
{
rets = s.substr(i, j);
if (s.find(rets, i + j) != string::npos && rets.size() > len)
{
len = rets.size();
oks = rets;
bf = true;
}
}
}

return bf;
}


O(n^2),ûÓп¼ÂÇsubstrÄÚ²¿µÄ¸´ÔÓ¶È¡£

ÎÊÌâÒªÇóÄÜ·ñÔÙÇåÎúһЩ

±ÈÈ磺"aababcabcd"µÄÇé¿öÏ£¬ab³öÏÖÁË3´Î£¬¶øabc³öÏÖÁË2´Î£¬Ó¦¸Ã·µ»ØÄÄÒ»¸ö£¿

#include <stdio.h>

#define BUF_MAX 1000


Ïà¹ØÎÊ´ð£º

jspÖÐ <c:if test> Ïà¹ØÎÊÌâ

ÔÚ²éѯºó½«²éѯ³öÀ´µÄÖµ¸³¸ø¸÷ÊäÈë¿ò
<c:if test="${not empty dataValue}">
      fm.SAMPLING_DATE.value=" <c:out value='${dataValue.SAMPLING_DATE}'/ ......

°Ù˼²»µÃÆä½âµÄC³ÌÐòÎÊÌ⣬¸ßÊÖÇë½ø£¡

ÎÊÌâÃèÊö£º
ÓÐÒ»¼òµ¥µÄC³ÌÐò£¬ÈçÏ£º
void foo ( ) {
int i ;
p r i n t f ( "%d " , i ++);
}
int main ( ){ int j ;
for ( j = 0 ; j < 1 0 ; ++j ) foo ( ) ;
}

º¯ ......

ÇóÖúcµÄÎÊÌâ

1001.exe ÖÐµÄ 0x0041394f ´¦Î´´¦ÀíµÄÒì³£: 0xC0000005: дÈëλÖà 0x66792e62 ʱ·¢Éú·ÃÎʳåÍ»

ÕâÊÇÔõô»ØÊ£¿Ð»Ð»ÁË£¬ÎÒÊDzËÄñ
Ë­ÖªµÀÔõô»ØÊ¡­¡­ÕâÊǸöͨÓõĴíÎóÌáʾ¡­¡­ÉÏ´úÂë

ÐèÒªÖØÐ½øÐбàÒë

Ò ......

ftpÉÏ´«ÏÂÔØcÎļþ·½Ê½

ÔÚueÖдÓÔ¶³ÌunixÓöþ½øÖÆ·½Ê½ÏÂÔØcÎļþµ½±¾µØ£¬ÐÞ¸ÄÖ®ºóÓöþ½øÖÆ·½Ê½ÉÏ´«µ½unixÖУ¬ÔÙÓÃvi´ò¿ª¸ÃÎļþ£¬Ã¿ÐкóÃæ¾Í»áÓÐÒ»¸ö^MµÄ»»Ðзû£¬Èç¹û²ÉÓÃascii·½Ê½ÏÂÔØ£¬¶þ½øÖÆ·½Ê½ÉÏ´«µÄ»°¾ÍûÓÐ^M£¬ÄÇÇëÎÊÕâÑù»á¶Ô³ÌÐòÎļþ ......

Õâ¸öÊÇʲôÒâ˼£¬unsigned int c:2, d:1;

struct s1 {
char ch, *ptr;
union {
short a, b;
unsigned int c:2, d:1;
}
struct s1 *next;
};


Ö÷Òª¿´²»¶®·ûºÅ¡¡:

Çë´ïÈËÖ¸µãÒ»¶þ
http://blog.cechina.cn/true ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ