摘要:
char firstNotrepeat(char *str){ if(str == NULL) return '\0'; int hash[256]; memset(hash, 0, sizeof(int)*256); char *p = str; while(*p != '\0'){ ++hash[*p]; ++p; } p = str; while(*p != '\0'){ if(hash[*p] == 1) return *p; p++; } return '\0';} 阅读全文
posted @ 2013-09-16 16:36
冰点猎手
阅读(176)
评论(0)
推荐(0)
摘要:
int minthree(int a1, int a2, int a3){ a1 = a1 q2, q3, q5; int res = 1; q2.push(2); q3.push(3); q5.push(5); while(index > 1){ --index; int tp = minthree(q2.front(), q3.front(), q5.front()); if(tp == q2.front()){ q2.pop(); q2.push(tp*2); q3.push(tp*3); q5.push(tp*5); }else if(tp == q3.fro... 阅读全文
posted @ 2013-09-16 16:22
冰点猎手
阅读(210)
评论(0)
推荐(0)
摘要:
const int g_maxlen = 10;char * g_strCombine1 = new char[g_maxlen*2 +1];char * g_strCombine2 = new char[g_maxlen*2 +1];int compare(const void *str1, const void *str2){ strcpy(g_strCombine1, *(const char **)str1); strcat(g_strCombine1, *(const char **)str2);// important strcpy(g_strCombine2, *(const c 阅读全文
posted @ 2013-09-16 15:26
冰点猎手
阅读(185)
评论(0)
推荐(0)
摘要:
>的解释没有编程之美的解释好。建议这题看编程之美的解释long long CountOne(long long n){ long long iCount = 0; long long ifactor = 1; long long ilower, icur, ihigher; while( n/ifactor != 0) { ilower = n % ifactor ; icur = (n/ifactor )%10 ; ihigher = n/(ifactor*10); switch(icur){ case 0: iCount += ihigher * ifactor;... 阅读全文
posted @ 2013-09-16 14:52
冰点猎手
阅读(217)
评论(0)
推荐(0)