锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品久久久天天影视,97久久香蕉国产线看观看,国内精品久久久久久久亚洲http://www.shnenglu.com/aaxron/category/15781.html璁板綍淇鐨勫嵃璁? zh-cnWed, 07 Aug 2013 23:02:26 GMTWed, 07 Aug 2013 23:02:26 GMT60鍒ゆ柇鎵嬫寚鎸変笅http://www.shnenglu.com/aaxron/archive/2013/08/06/202371.html澶╀笅澶╀笅Tue, 06 Aug 2013 10:47:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/08/06/202371.htmlhttp://www.shnenglu.com/aaxron/comments/202371.htmlhttp://www.shnenglu.com/aaxron/archive/2013/08/06/202371.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/202371.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/202371.htmlvoid BlockVar(const UINT8 *pImg, UINT32 *p_var, UINT32 *p_avr)
{
    UINT8 i;
    UINT8 j;
    UINT8 *p;
    UINT32 AverTemp=0;
    UINT32 VarTemp=0;

    p=(UINT8 *)pImg;
    //block 32*32
    for(i=0;i<32;i++)
    {
        p=(UINT8*)(pImg+256*i);
        for(j=0;j<32;j++)
        {
            AverTemp+=*p;
            p++;
        }
    }
    AverTemp>>=10;
    *p_avr=AverTemp;

    for(i=0;i<32;i++)
    {
        p=(UINT8 *)(pImg+256*i);
        for(j=0;j<32;j++)
        {
            VarTemp+=SQ((*p)-AverTemp);
            p++;
        }
    }
    *p_var=(VarTemp>>10);

}

bool FpIsPressFinger(const UINT8 *pImg)
{
    UINT32  AverTemp=0;
    UINT32  VarTemp=0;
    UINT32  Aver_Var_Val = 0;

    UINT32  VarTemps    =0;
    UINT32  AverTemps = 0;    

    //BLOCK 1
    BlockVar(pImg+(85+6)*256+256/3+11,&VarTemp,&AverTemp);
    AverTemps+=AverTemp;
    VarTemps+=VarTemp;

    //BLOCK 2
    BlockVar(pImg+(85+6)*256+256/3+11+32+10,&VarTemp,&AverTemp);
    AverTemps+=AverTemp;
    VarTemps+=VarTemp;

    //BLOCK 3
    BlockVar(pImg+(85+7+32+6)*256+256/3+11,&VarTemp,&AverTemp);
    AverTemps+=AverTemp;
    VarTemps+=VarTemp;

    //BLOCK 4
    BlockVar(pImg+(85+7+32+6)*256+256/3+11+32+10,&VarTemp,&AverTemp);
    AverTemps+=AverTemp;
    VarTemps+=VarTemp;

    AverTemps>>=2;
    VarTemps>>=2;
    pr_debug("VarTemps=%u,AverTemps=%u \r\n",VarTemps,AverTemps);
    return (bool)(( AverTemps<=185 ) && (VarTemps >=70));
}

澶╀笅 2013-08-06 18:47 鍙戣〃璇勮
]]>
璁$畻鏈鴻瑙夈佹満鍣ㄥ涔犵浉鍏抽鍩熻鏂囧拰婧愪唬鐮佸ぇ闆嗗悎(杞? http://www.shnenglu.com/aaxron/archive/2013/04/26/199726.html澶╀笅澶╀笅Fri, 26 Apr 2013 00:42:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/04/26/199726.htmlhttp://www.shnenglu.com/aaxron/comments/199726.htmlhttp://www.shnenglu.com/aaxron/archive/2013/04/26/199726.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/199726.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/199726.html闃呰鍏ㄦ枃

澶╀笅 2013-04-26 08:42 鍙戣〃璇勮
]]>
[杞琞涓冪鎺掑簭綆楁硶鐨勭畝鍗曞垎鏋愪笌瀹炵幇http://www.shnenglu.com/aaxron/archive/2013/03/27/198871.html澶╀笅澶╀笅Wed, 27 Mar 2013 10:23:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/27/198871.htmlhttp://www.shnenglu.com/aaxron/comments/198871.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/27/198871.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198871.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198871.html/*
杞嚜:
http://www.shnenglu.com/chenjt3533/archive/2013/03/25/198815.html 
*/
#include "stdafx.h"



/*
             --- 鍐掓場鎺掑簭 --- 
鑷笅鑰屼笂鐨勪袱涓ゆ瘮杈冿紝灝忔場鎺掑湪澶ф場鍓嶏紝涓瓚熷啋鍑轟竴涓渶灝忔場銆?br />
*/

void BubbleSort(int nArray[], int nLength)
{
    int i = nLength - 1;
    int j = 0;
    int temp = 0;

    for (i = nLength - 1; i > 0; --i)
    {
        for (j = i - 1; j >= 0; --j)
        {
            if (nArray[j] > nArray[j + 1])
            {
                temp = nArray[j + 1];
                nArray[j + 1] = nArray[j];
                nArray[j] = temp;
            }
        }
    }
}


/*
                    --- 閫夋嫨鎺掑簭 --- 
鑷笅鑰屼笂鐨勪袱涓ゆ瘮杈冿紝璁板綍鏈灝忔暟鐨勪笅鏍囷紝灝嗘渶涓婇潰鐨勬暟涓庢渶灝忔暟浜ゆ崲銆?br />
*/

void SelectSort(int nArray[], int nLength)
{
    int tempIndex = 0;
    int tempValue = 0;

    for (int i = 0; i < nLength; ++i)
    {
        tempIndex = i;
        for (int j = i + 1; j < nLength; ++j)
        {
            if (nArray[tempIndex] > nArray[j])
            {
                tempIndex = j;
            }
        }
        tempValue = nArray[i];
        nArray[i] = nArray[tempIndex];
        nArray[tempIndex] = tempValue;
    }
}


/*
                    --- 鎻掑叆鎺掑簭 --- 
灝嗘暟鎹彃鍏ュ埌宸叉帓搴忕殑搴忓垪涓紝杈規壘鍚堥傜殑浣嶇疆錛岃竟縐誨姩鏁版嵁錛屾壘鍒板悎閫備綅緗彃鍏ユ暟鎹?br />
*/

void InsertSort(int nArray[], int nLength)
{
    for (int i = 1; i < nLength; ++i)
    {
        int temp = nArray[i];
        int j = i;
        for (; j > 0 && nArray[j - 1] > temp; --j)
        {
            nArray[j] = nArray[j - 1];
        }
        nArray[j] = temp;
    }    
}


/*
                    --- 蹇熸帓搴?nbsp;--- 
鏄鍐掓場鎺掑簭鐨勬敼榪涖?br />1錛庡厛浠庢暟鍒椾腑鍙栧嚭涓涓暟浣滀負鍩哄噯鏁?
2錛庡垎鍖鴻繃紼嬶紝灝嗘瘮榪欎釜鏁板ぇ鐨勬暟鍏ㄦ斁鍒板畠鐨勫彸杈癸紝灝忎簬鎴栫瓑浜庡畠鐨勬暟鍏ㄦ斁鍒板畠鐨勫乏杈?
3錛庡啀瀵瑰乏鍙沖尯闂撮噸澶嶇浜屾錛岀洿鍒板悇鍖洪棿鍙湁涓涓暟.

鍒嗗尯榪囩▼鍙互褰㈣薄鐨勬弿榪頒負“鎸栧潙濉暟”錛?br />1錛庡皢鍩哄噯鏁皀Base鎸栧嚭褰㈡垚絎竴涓潙nArray[nLow];
2錛巒High--鐢卞悗鍚戝墠鎵炬瘮nBase灝忕殑鏁幫紝鎵懼埌鍚庢寲鍑烘鏁板~鍓嶄竴涓潙nArray[nLow]涓?
3錛巒Low++鐢卞墠鍚戝悗鎵炬瘮nBase澶х殑鏁幫紝鎵懼埌鍚庝篃鎸栧嚭姝ゆ暟濉埌鍓嶄竴涓潙nArray[nHigh]涓?
4錛庡啀閲嶅鎵ц2錛?浜屾錛岀洿鍒皀Low==nHigh錛屽皢鍩哄噯鏁皀Base濉叆nArray[nLow]涓?
*/

int AdjustArray(int nArray[], int nLow, int nHigh)
{
    int nBase = nArray[nLow];

    while(nLow < nHigh)
    {
        while(nLow < nHigh && nBase <= nArray[nHigh])
            --nHigh;
        if (nLow < nHigh)
        {
            nArray[nLow++] = nArray[nHigh];
        }

        while(nLow < nHigh && nBase > nArray[nLow])
            ++nLow;
        if (nLow < nHigh)
        {    
            nArray[nHigh--] = nArray[nLow];
        }
    }
    nArray[nLow] = nBase;
    return nLow;
}

void QuickSort(int nArray[], int nLow, int nHigh)
{
    if (nLow < nHigh)
    {
        int nMid = AdjustArray(nArray, nLow, nHigh);
        QuickSort(nArray, 0, nMid - 1);
        QuickSort(nArray, nMid + 1, nHigh);
    }
}


/*                
                    --- 甯屽皵鎺掑簭 --- 
鏄鐩存帴鎻掑叆鎺掑簭綆楁硶鐨勬敼榪涳紝鍙堢О緙╁皬澧為噺鎺掑簭銆?br />1銆佸皢鏁扮粍榪涜鍒嗙粍錛屼笅鏍囩浉宸甦鐨勪負涓緇勶紱
2銆佸姣忕粍涓叏閮ㄥ厓绱犺繘琛屾帓搴忥紱
3銆佺劧鍚庡啀鐢ㄤ竴涓緝灝忕殑澧為噺d, 閲嶅1銆?錛岀洿鍒癲涓?鏃訛紝鎺掑簭瀹屾垚銆?br />
涓鑸閲忓彇鍊間負涓婁竴嬈$殑涓鍗婏紝d = 1/2 d錛岀涓嬈″彇鍊間負鏁扮粍闀垮害鐨勪竴鍗娿?br />
*/

void ShellSort(int nArray[], int nLength)
{
    for (int nDifference = nLength / 2; nDifference > 0; nDifference = nDifference / 2)
    {
        for (int i = nDifference; i < nLength; ++i)
        {
            int temp = nArray[i];
            int j = i;
            for (; j > 0 && nArray[j - 1] > temp; --j)
            {
                nArray[j] = nArray[j - 1];
            }
            nArray[j] = temp;
        }
    }
}


/*                
                    --- 褰掑茍鎺掑簭 --- 
鏄皢涓や釜宸茬粡鎺掑簭鐨勫簭鍒楀悎騫舵垚涓涓湁搴忓簭鍒椼?br />1銆佸緟鎺掑簭搴忓垪鍒嗕負涓や釜瀛愬簭鍒?
2銆佹瘡涓瓙搴忓垪閲嶅姝ラ1錛岀洿鍒版瘡涓瓙搴忓垪鍙湁涓涓厓绱?
3銆佹寜澶у皬欏哄簭鍚堝茍涓や釜瀛愬簭鍒?
4銆侀噸澶嶆楠?錛岀洿鍒板悎騫朵負涓涓暣浣撴湁搴忓簭鍒楋紝鎺掑簭瀹屾垚銆?br />
*/

void Merge(int nArray[], int nLow, int nHigh)
{
    int nFirst = nLow;
    int nMid = (nLow + nHigh) / 2;
    int nSecond = nMid + 1;
    int* p = (int*)malloc(sizeof(int) * (nHigh - nLow + 1));
    int nIndex = 0;

    while(nFirst <= nMid && nSecond <= nHigh)
    {
        if (nArray[nFirst] > nArray[nSecond])
        {
            p[nIndex] = nArray[nSecond++];
        }
        else
        {
            p[nIndex] = nArray[nFirst++];
        }
        ++nIndex;
    }

    while (nFirst <= nMid)
    {    
        p[nIndex++] = nArray[nFirst++];
    }

    while (nSecond <= nHigh)
    {    
        p[nIndex++] = nArray[nSecond++];
    }

    for (int i = 0; i <= nIndex && nLow <= nHigh;)
    {
        nArray[nLow++] = p[i++];
    }
    free(p);
}

void MergeSort(int nArray[], int nLow, int nHigh)
{
    if (nLow < nHigh)
    {
        int nMid = (nLow + nHigh) / 2;
        MergeSort(nArray, nLow, nMid);
        MergeSort(nArray, nMid+1, nHigh);
        Merge(nArray, nLow, nHigh);
    }
}


/*            
                    --- 鍫嗘帓搴?nbsp;--- 
1銆佸厛灝嗘暟緇勮漿鎹負瀹屽叏浜屽弶鏍戯紱
2銆佽皟鏁翠簩鍙夋爲褰㈠澶ч《鍫嗭紱
3銆佸皢鏍圭粨鐐逛笌鏈鍚庝竴涓彾瀛愮粨鐐逛簰鎹紝鍗沖皢鏈澶у厓绱犳斁鍦ㄦ暟緇勭殑鏈熬錛屾暟緇勭殑闀垮害鍑忎竴錛?br />4銆佸啀閲嶅2銆?錛岀洿鍒版暟緇勯暱搴︿負1錛屾帓搴忓畬鎴愩?br />
*/

void AdjustHeap(int nArray[], int nLength, int nIndex)
{
    int nLeft = nIndex * 2 + 1;
    int nRight = nIndex * 2 + 2;
    int nParent = nIndex;

    while(nLeft < nLength && nRight < nLength)
    {
        int nBigIndex = (nArray[nLeft] > nArray[nRight] ? nLeft : nRight);
        if (nArray[nParent] < nArray[nBigIndex])
        {
            int temp = nArray[nParent];
            nArray[nParent] = nArray[nBigIndex];
            nArray[nBigIndex] = temp;

            nLeft = nBigIndex * 2 + 1;
            nRight = nBigIndex * 2 + 2;
        }
        break;
    }
}

void BuildHeap(int nArray[], int nLength)
{
    for (int i = nLength / 2 - 1; i >= 0; --i)
    {
        AdjustHeap(nArray, nLength, i);
    }
}

void HeapSort(int nArray[], int nLength)
{
    BuildHeap(nArray, nLength);

    while(nLength > 1)
    {
        int temp = nArray[0];
        nArray[0] = nArray[nLength - 1];
        nArray[nLength - 1] = temp;
        AdjustHeap(nArray, --nLength, 0);
    }
}

void Test_Sort()
{
    int nArray[5] = {1,3,2,5,4};
    BubbleSort(nArray, 5);
    //SelectSort(nArray, 5);
    
//InsertSort(nArray, 5);
    
//QuickSort(nArray, 0, 4);
    
//ShellSort(nArray, 5);
    
//MergeSort(nArray, 0, 4);
    
//HeapSort(nArray, 5);
    for (int n = 0; n < 5; ++n)
    {
        std::cout << nArray[n] << " ";
    }
    std::cout << std::endl;
}
int main()
{
    Test_Sort();
    system("pause");
    return 0;
}

澶╀笅 2013-03-27 18:23 鍙戣〃璇勮
]]>
鍔ㄦ佽鍒掔畻娉曪紙5錛夛細鑳屽寘鏈澶т環鍊奸棶棰?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/27/198857.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Wed, 27 Mar 2013 01:53:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/27/198857.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198857.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/27/198857.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198857.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198857.html</trackback:ping><description><![CDATA[<div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#include "stdafx.h"<br /><br /><span style="color: #0000FF; ">int</span> c[20][100];<span style="color: #008000; ">/*</span><span style="color: #008000; ">瀵瑰簲姣忕鎯呭喌鐨勬渶澶т環鍊?/span><span style="color: #008000; ">*/</span><br /><br /><br /><span style="color: #008000; ">//</span><span style="color: #008000; ">int m 鑳屽寘瀹歸噺<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">int n 鑳屽寘涓暟</span><span style="color: #008000; "><br /></span><span style="color: #0000FF; ">int</span> knapsack(<span style="color: #0000FF; ">int</span> m,<span style="color: #0000FF; ">int</span> n)<br />{<br />    <span style="color: #0000FF; ">int</span> i,j,w[20],p[20];<br />    <span style="color: #0000FF; ">for</span>(i=1;i<n+1;i++) <br />    {<br />        printf("璇瘋緭鍏ョ(%d)涓墿鍝侀噸閲?浠峰?\n",i);<br />        scanf("%d,%d",&w[i],&p[i]);<br />    }    <br />    <span style="color: #0000FF; ">for</span>(i=0;i<10;i++)<br />        <span style="color: #0000FF; ">for</span>(j=0;j<100;j++)<br />            c[i][j]=0;<span style="color: #008000; ">/*</span><span style="color: #008000; ">鍒濆鍖栨暟緇?/span><span style="color: #008000; ">*/</span><br /><br />    <span style="color: #0000FF; ">for</span>(i=1;i<n+1;i++)<br />    {<br />        <span style="color: #0000FF; ">for</span>(j=1;j<m+1;j++)<br />        {<br />            <span style="color: #0000FF; ">if</span>(w[i]<=j) <span style="color: #008000; ">/*</span><span style="color: #008000; ">濡傛灉褰撳墠鐗╁搧鐨勫閲忓皬浜庤儗鍖呭閲?/span><span style="color: #008000; ">*/</span><br />            {<br />                <span style="color: #0000FF; ">if</span>(p[i]+c[i-1][j-w[i]]>c[i-1][j])<br />                {<br />                    <span style="color: #008000; ">//</span><span style="color: #008000; ">濡傛灉鏈墿鍝佺殑浠峰煎姞涓婅儗鍖呭墿涓嬬殑絀洪棿鑳芥斁鐨勭墿鍝佺殑浠峰?br />                    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">澶т簬涓婁竴嬈¢夋嫨鐨勬渶浣蟲柟妗?<br />                    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">鍒欐洿鏂癱[i][j]</span><span style="color: #008000; "><br /></span>                    c[i][j]=p[i]+c[i-1][j-w[i]];<br />                }<br />                <span style="color: #0000FF; ">else</span> <br />                {<br />                    c[i][j]=c[i-1][j];<br />                }<br />            }<br />            <span style="color: #0000FF; ">else</span> c[i][j]=c[i-1][j];<br />        }<br />    }<br />    <span style="color: #0000FF; ">return</span>(c[n][m]);<br />}<br /><span style="color: #0000FF; ">int</span> main()<br />{<br />    <span style="color: #008000; ">//</span><span style="color: #008000; ">int m 鑳屽寘瀹歸噺<br />    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">int n 鑳屽寘涓暟</span><span style="color: #008000; "><br /></span>    <span style="color: #0000FF; ">int</span> m,n;<br />    <br /><br />    printf("璇瘋緭鍏ヨ儗鍖呮渶澶ф壙閲?鐗╁搧涓暟:\n");<br />    scanf("%d,%d",&m,&n);<br />    <br />    printf("鏈澶т環鍊?%d \r\n",knapsack(m,n));<br /><br />    <span style="color: #0000FF; ">int</span> i,j;<br /><br />    m += 3;<br />    n += 3;<br />    <span style="color: #0000FF; ">for</span>(j=0;j<m;j++)<br />    {<br />        printf("%02d  ",j);<br />    }<br />    printf("\r\n");<br />    <span style="color: #0000FF; ">for</span>(j=0;j<m;j++)<br />    {<br />        printf("----",j);<br />    }<br />    printf("\r\n");<br />    <span style="color: #0000FF; ">for</span>(i=0;i<n;i++)<br />    {<br />        <span style="color: #0000FF; ">for</span>(j=0;j<m;j++)<br />        {<br />            printf("%02d  ",c[i][j]);<br />            <span style="color: #0000FF; ">if</span>(j==m-1) printf("\n");<br />        }<br />    }<br />    system("pause");<br /><br />    <span style="color: #0000FF; ">return</span> 0;<br /><br />}</div></div><img src ="http://www.shnenglu.com/aaxron/aggbug/198857.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-27 09:53 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/27/198857.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>crc32 For Linux 瀛樻。http://www.shnenglu.com/aaxron/archive/2013/03/25/198800.html澶╀笅澶╀笅Mon, 25 Mar 2013 03:49:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/25/198800.htmlhttp://www.shnenglu.com/aaxron/comments/198800.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/25/198800.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198800.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198800.html//緙栬瘧:/usr/local/arm/4.3.1/bin/arm-linux-g++
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>


typedef unsigned int DWORD;
typedef unsigned char BYTE;

unsigned int GetTickCount(void)
{
    struct timeval tv;
    if (gettimeofday(&tv, NULL)!=0) 
        return 0;
    return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}

void PrintCrcTable()
{
    //Poly = 0xedb88320 WinRAR Poly
    DWORD Val;
    for (DWORD i = 0; i < 256; i++)
    {
        Val = i;
        for (DWORD k = 0; k < 8; k++)
        {
            if (Val & 1)
                Val = 0xedb88320L ^ (Val >> 1);
            else
                Val = Val >> 1;
        }
        printf ("0x%08x, ", Val);
        if (0 == ((i+1)%6))
            printf ("\n");
    }
}



const DWORD Crc32Table[] =
{
    0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
    0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
    0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
    0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
    0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
    0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
    0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
    0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
    0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
    0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
    0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
    0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
    0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
    0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
    0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
    0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
    0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
    0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
    0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
    0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
    0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
    0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
    0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
    0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
    0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
    0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
    0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
    0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
    0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
    0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
    0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
    0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
    0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
    0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
    0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
    0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
    0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
    0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
    0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
    0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
    0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
    0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
    0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};

DWORD GenerateCrc32(DWORD PartialCrc,BYTE* Buffer,DWORD Length)
{
    DWORD crc;
    DWORD i;

    // Generate the CRC32 checksum.
    crc = PartialCrc ^ 0xffffffffL;

    for (i = 0; i < Length; i++)
    {
        crc = Crc32Table[(crc ^ Buffer[i]) & 0xff] ^ (crc >> 8);
    }

    return (crc ^ 0xffffffffL);
}

//嫻嬭瘯紼嬪簭
int main(int argc,char* argv[])
{
    char* szFileName = NULL;
    if (argc<2)
    {
        printf("Usage:%s <filename> \r\n",argv[0]);
        return -1;
    }
    szFileName = argv[1];
    FILE *fp = fopen(szFileName,"rb");
    if(NULL == fp) 
    {
        printf("Open %s error:%d \r\n",szFileName);
        return 0;
    }

    DWORD dwStartTime = GetTickCount();
    printf("dwStartTime:%u \r\n",dwStartTime);
    DWORD crc32 = 0;
    BYTE c = 0;
    while(1 == fread(&c,1,1,fp))
        crc32 = GenerateCrc32(crc32,&c,1);

    fclose(fp);
    DWORD dwEndTime = GetTickCount();
    printf("dwEndTime:%u \r\n",dwEndTime);
    printf("calc_crc32(%s) = 0x%08X ,elapsed %u (ms) \r\n",szFileName,crc32,dwEndTime - dwStartTime);
    return 0;
}

澶╀笅 2013-03-25 11:49 鍙戣〃璇勮
]]>
鍔ㄦ佽鍒掔畻娉曪紙4錛夛細lcs閫掑綊綆楁硶python鐨勫疄鐜?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Thu, 21 Mar 2013 11:01:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198690.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198690.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198690.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008000">#</span><span style="color: #008000">coding:gbk</span><span style="color: #008000"><br /></span><span style="color: #0000ff">import</span><span style="color: #000000"> os,sys<br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> lcs(short, long):<br />    m </span><span style="color: #000000">=</span><span style="color: #000000"> len(short)<br />    n </span><span style="color: #000000">=</span><span style="color: #000000"> len(long)<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (m </span><span style="color: #000000"><=</span><span style="color: #000000"> 0 </span><span style="color: #0000ff">or</span><span style="color: #000000"> n </span><span style="color: #000000"><=</span><span style="color: #000000"> 0):<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> m</span><span style="color: #000000">></span><span style="color: #000000">n:<br />        short,long </span><span style="color: #000000">=</span><span style="color: #000000"> long,short<br /><br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> short </span><span style="color: #0000ff">in</span><span style="color: #000000"> long:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> short<br />    t1 </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(short[</span><span style="color: #000000">1</span><span style="color: #000000">:],long)<br />    t2 </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(short[0:</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">],long)<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> t1</span><span style="color: #000000">></span><span style="color: #000000">t2:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> t1<br />    </span><span style="color: #0000ff">else</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> t2<br /><br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> main():<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> len(sys.argv)</span><span style="color: #000000"><</span><span style="color: #000000">3</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">浣跨敤:lcs <瀛楃涓?> <瀛楃涓?></span><span style="color: #800000">"</span><span style="color: #000000"><br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"><br />    a </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(sys.argv[</span><span style="color: #000000">1</span><span style="color: #000000">],sys.argv[</span><span style="color: #000000">2</span><span style="color: #000000">])<br />    </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">鏈澶у叕鍏卞瓙涓查暱搴?%d</span><span style="color: #800000">"</span><span style="color: #000000">%</span><span style="color: #000000">len(a)<br />    </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">鏈澶у叕鍏卞瓙涓?</span><span style="color: #800000">"</span><span style="color: #000000">+</span><span style="color: #000000">a<br /></span><span style="color: #0000ff">if</span><span style="color: #000000"> </span><span style="color: #800080">__name__</span><span style="color: #000000"> </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">__main__</span><span style="color: #800000">'</span><span style="color: #000000">:<br />    main()<br /><br /></span></div><img src ="http://www.shnenglu.com/aaxron/aggbug/198690.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-21 19:01 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍔ㄦ佽鍒掔畻娉曪紙3錛夛細鑿叉嘗閭e鏁板垪http://www.shnenglu.com/aaxron/archive/2013/03/21/198683.html澶╀笅澶╀笅Thu, 21 Mar 2013 08:25:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/21/198683.htmlhttp://www.shnenglu.com/aaxron/comments/198683.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/21/198683.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198683.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198683.html鍘熷垱浣滃搧錛屽厑璁歌漿杞斤紝杞澆鏃惰鍔″繀浠ヨ秴閾炬帴褰㈠紡鏍囨槑鏂囩珷

#include "stdafx.h"
using namespace std;

/*
algorithm
鍦ㄦ暟瀛椾笂閫掑綊琛ㄧず鐨勯棶棰樹篃鍙互琛ㄧず鎴愰掑綊綆楁硶錛屽湪璁稿鎯呭艦涓嬪鏈寸礌鐨勭┓涓炬悳绱㈠緱鍒版樉钁楃殑鎬ц兘鏀硅繘銆?br />浠諱綍鏁板瓧閫掓帹鍏紡閮藉彲浠ョ洿鎺ョ炕璇戞垚閫掑綊綆楁硶錛屼絾鏄熀鏈幇瀹炴槸緙栬瘧鍣ㄥ父甯鎬笉鑳芥紜湴瀵瑰緟閫掑綊綆楁硶錛岀粨鏋滀駭鐢熶綆鏁堢殑紼嬪簭錛屽綋鎬鐤戝彲鑳芥槸榪欑鎯呭喌鏃訛紝
蹇呴』鍐嶇粰緙栬瘧鍣ㄦ彁渚涗竴浜涘府鍔╋紝灝嗛掑綊綆楁硶閲嶆柊鍐欐垚闈為掑綊綆楁硶錛岃鍚庤呮妸榪欎簺瀛愰棶棰樼殑絳旀緋葷粺鍦拌褰曞湪涓涓〃錛坱able錛夊唴錛?br />鍒╃敤榪欑鏂規硶鐨勪竴縐嶆妧宸хО涓哄姩鎬佽鍒掞紙dynamic programming錛夈?br />

鑿叉嘗閭e鏁板垪鎸囩殑鏄繖鏍蜂竴涓暟鍒楋細 
1錛?錛?錛?錛?錛?錛?3錛?1…… 
榪欎釜鏁板垪浠庣浜岄」寮濮嬶紝姣忎竴欏歸兘絳変簬鍓嶄袱欏逛箣鍜?br />
*/




unsigned 
int fib1(unsigned int n)
{
    
if (n<=1)
    {
        
return 1;
    }
    
else
    {
        
return fib1(n-1+ fib1(n-2);
    }
}

unsigned 
int fib2(unsigned int n)
{
    
if (n<=1)
    {
        
return 1;
    }
    unsigned 
int fib_n        = 1;
    unsigned 
int fib_n_1    = 1;
    unsigned 
int fib_n_2    = 1;

    
for (int i=2;i<=n;i++)
    {
        fib_n      
= fib_n_1 + fib_n_2;
        fib_n_2   
= fib_n_1;
        fib_n_1   
= fib_n;
    }
    
return fib_n;
}

int main()
{
    
for (int i=1;i<11;i++)
    {
        printf(
"fib1(%u)=%u \r\n",i,fib1(i));
        printf(
"fib2(%u)=%u \r\n",i,fib2(i));
    }
    system(
"pause");
    
return 0;
}   

 



澶╀笅 2013-03-21 16:25 鍙戣〃璇勮
]]>
鍥炴函綆楁硶(2):鍏殗鍚庨棶棰橈紙闈為掑綊錛?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/20/198638.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Wed, 20 Mar 2013 10:09:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/20/198638.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198638.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/20/198638.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198638.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198638.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">#include </span><span style="color: #000000">"</span><span style="color: #000000">stdafx.h</span><span style="color: #000000">"</span><span style="color: #000000"><br /></span><span style="color: #0000ff">using</span><span style="color: #000000"> </span><span style="color: #0000ff">namespace</span><span style="color: #000000"> std;<br /><br /></span><span style="color: #0000ff">const</span><span style="color: #000000">  </span><span style="color: #0000ff">int</span><span style="color: #000000"> n </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">9</span><span style="color: #000000">;<br /></span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> matrix[n];<br /><br /></span><span style="color: #0000ff">bool</span><span style="color: #000000"> place(</span><span style="color: #0000ff">int</span><span style="color: #000000"> row,</span><span style="color: #0000ff">int</span><span style="color: #000000"> col)<br />{<br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> (</span><span style="color: #0000ff">int</span><span style="color: #000000"> prev </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">; prev </span><span style="color: #000000"><</span><span style="color: #000000"> row; prev</span><span style="color: #000000">++</span><span style="color: #000000">)<br />        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (matrix[prev] </span><span style="color: #000000">==</span><span style="color: #000000"> col </span><span style="color: #000000">||</span><span style="color: #000000"> labs(col</span><span style="color: #000000">-</span><span style="color: #000000">matrix[prev]) </span><span style="color: #000000">==</span><span style="color: #000000"> labs(row</span><span style="color: #000000">-</span><span style="color: #000000">prev)) </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">true</span><span style="color: #000000">;<br />}<br /><br /></span><span style="color: #0000ff">void</span><span style="color: #000000"> display()  </span><span style="color: #008000">//</span><span style="color: #008000">鎵撳嵃姣忎釜鐨囧悗鐨勫垪鐨勪綅緗?/span><span style="color: #008000"><br /></span><span style="color: #000000">{<br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> i;<br />    cout</span><span style="color: #000000"><<</span><span style="color: #000000">"</span><span style="color: #000000">[</span><span style="color: #000000">"</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> (i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">; i </span><span style="color: #000000"><=</span><span style="color: #000000">7</span><span style="color: #000000">; i</span><span style="color: #000000">++</span><span style="color: #000000">)<br />        cout</span><span style="color: #000000"><<</span><span style="color: #000000">matrix[i]</span><span style="color: #000000"><<</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">;<br />    cout</span><span style="color: #000000"><<</span><span style="color: #000000">matrix[i]</span><span style="color: #000000"><<</span><span style="color: #000000">"</span><span style="color: #000000">]</span><span style="color: #000000">"</span><span style="color: #000000"><<</span><span style="color: #000000">endl;<br />}<br /><br /></span><span style="color: #0000ff">void</span><span style="color: #000000"> queen(</span><span style="color: #0000ff">int</span><span style="color: #000000"> row)<br />{<br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> count </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">bool</span><span style="color: #000000"> ret </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">int</span><span style="color: #000000">  col </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />    memset(matrix,</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(matrix));<br />    </span><span style="color: #0000ff">while</span><span style="color: #000000"> (row </span><span style="color: #000000"><=</span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">)<br />    {<br />        ret </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;<br />        </span><span style="color: #0000ff">for</span><span style="color: #000000"> (col </span><span style="color: #000000">=</span><span style="color: #000000"> matrix[row] </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">; col </span><span style="color: #000000"><=</span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">; col</span><span style="color: #000000">++</span><span style="color: #000000">)<br />        {<br />            ret </span><span style="color: #000000">=</span><span style="color: #000000"> place(row,col);<br />            </span><span style="color: #0000ff">if</span><span style="color: #000000"> (ret)     </span><span style="color: #008000">//</span><span style="color: #008000">濡傛灉(x,y)浣嶇疆鑳藉惁鎽嗘斁鐨囧悗</span><span style="color: #008000"><br /></span><span style="color: #000000">            {<br />                matrix[row] </span><span style="color: #000000">=</span><span style="color: #000000"> col;  </span><span style="color: #008000">//</span><span style="color: #008000">灝嗙i琛岀殑鐨囧悗鎽嗘斁鍦ㄧj鍒?/span><span style="color: #008000"><br /></span><span style="color: #000000">                </span><span style="color: #0000ff">break</span><span style="color: #000000">;      </span><span style="color: #008000">//</span><span style="color: #008000">璺沖嚭榪欎竴灞傚驚鐜紝寮濮嬫憜鏀句笅涓琛岀殑鐨囧悗</span><span style="color: #008000"><br /></span><span style="color: #000000">            }<br />        }<br />        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #000000">!</span><span style="color: #000000">ret)  </span><span style="color: #008000">//</span><span style="color: #008000">濡傛灉寰幆瀹岃繖涓琛岋紝姣忎釜浣嶇疆閮藉啿紿?/span><span style="color: #008000"><br /></span><span style="color: #000000">        {<br />            matrix[row] </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000">灝嗚繖涓琛岀殑鐨囧悗浣嶇疆閲嶇疆涓?;</span><span style="color: #008000"><br /></span><span style="color: #000000">            row</span><span style="color: #000000">--</span><span style="color: #000000">;       </span><span style="color: #008000">//</span><span style="color: #008000">榪斿洖鍒頒笂涓琛?/span><span style="color: #008000"><br /></span><span style="color: #000000">            </span><span style="color: #0000ff">if</span><span style="color: #000000">(row</span><span style="color: #000000">==</span><span style="color: #000000">0</span><span style="color: #000000">)</span><span style="color: #0000ff">break</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000">濡傛灉宸茬粡榪斿洖鍒頒簡絎?琛岋紝璇存槑鎵鏈夋儏鍐甸兘鎵懼畬浜?/span><span style="color: #008000"><br /></span><span style="color: #000000">        }<br />        </span><span style="color: #0000ff">else</span><span style="color: #000000"><br />        {<br />            </span><span style="color: #0000ff">if</span><span style="color: #000000"> (row </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">)  </span><span style="color: #008000">//</span><span style="color: #008000">濡傛灉鎵懼埌浜嗙8琛岋紝璇存槑鏈夋弧瓚蟲潯浠剁殑緇撴灉</span><span style="color: #008000"><br /></span><span style="color: #000000">            {<br />                display();  </span><span style="color: #008000">//</span><span style="color: #008000">杈撳嚭緇撴灉</span><span style="color: #008000"><br /></span><span style="color: #000000">                count</span><span style="color: #000000">++</span><span style="color: #000000">;<br />            }<br />            </span><span style="color: #0000ff">else</span><span style="color: #000000"> row</span><span style="color: #000000">++</span><span style="color: #000000">;<br />        }<br />    }<br />    cout</span><span style="color: #000000"><<</span><span style="color: #000000">count</span><span style="color: #000000"><<</span><span style="color: #000000">endl;<br />}<br /></span><span style="color: #0000ff">int</span><span style="color: #000000"> main()<br />{<br />    queen(</span><span style="color: #000000">1</span><span style="color: #000000">);<br />    system(</span><span style="color: #000000">"</span><span style="color: #000000">pause</span><span style="color: #000000">"</span><span style="color: #000000">);<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />}   <br /></span></div><img src ="http://www.shnenglu.com/aaxron/aggbug/198638.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-20 18:09 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/20/198638.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍥炴函綆楁硶(1):鍏殗鍚庨棶棰?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/20/198631.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Wed, 20 Mar 2013 07:37:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/20/198631.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198631.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/20/198631.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198631.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198631.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">#include </span><span style="color: #000000">"</span><span style="color: #000000">stdafx.h</span><span style="color: #000000">"</span><span style="color: #000000"><br /><br /></span><span style="color: #008000">/*</span><span style="color: #008000"><br />綆楁硶緋誨垪---鍥炴函綆楁硶<br />寮曡█<br />瀵繪壘闂鐨勮В鐨勪竴縐嶅彲闈犵殑鏂規硶鏄鍏堝垪鍑烘墍鏈夊欓夎В錛岀劧鍚庝緷嬈℃鏌ユ瘡涓涓紝鍦ㄦ鏌ュ畬鎵鏈夋垨閮ㄥ垎鍊欓夎В鍚庯紝鍗沖彲鎵懼埌鎵闇瑕佺殑瑙c傜悊璁轟笂錛屽綋鍊欓夎В鏁伴噺鏈夐檺騫朵笖閫氳繃媯鏌ユ墍鏈夋垨閮ㄥ垎鍊欓夎В鑳藉寰楀埌鎵闇瑙f椂錛屼笂榪版柟娉曟槸鍙鐨勩備笉榪囷紝鍦ㄥ疄闄呭簲鐢ㄤ腑錛屽緢灝戜嬌鐢ㄨ繖縐嶆柟娉曪紝鍥犱負鍊欓夎В鐨勬暟閲忛氬父閮介潪甯稿ぇ(姣斿鎸囨暟綰э紝鐢氳嚦鏄ぇ鏁伴樁涔橈級錛屽嵆渚塊噰鐢ㄦ渶蹇殑璁$畻鏈轟篃鍙兘瑙e喅瑙勬ā寰堝皬鐨勯棶棰樸傚鍊欓夎В榪涜緋葷粺媯鏌ョ殑鏂規硶鏈夊縐嶏紝鍏朵腑鍥炴函鍜屽垎鏋濆畾鐣屾硶鏄瘮杈冨父鐢ㄧ殑涓ょ鏂規硶銆傛寜鐓ц繖涓ょ鏂規硶瀵瑰欓夎В榪涜緋葷粺媯鏌ラ氬父浼氫嬌闂鐨勬眰瑙f椂闂村ぇ澶у噺灝?鏃犺瀵逛簬鏈鍧忔儏褰㈣繕鏄浜庝竴鑸儏褰級銆備簨瀹炰笂錛岃繖浜涙柟娉曞彲浠ヤ嬌鎴戜滑閬垮厤瀵瑰緢澶х殑鍊欓夎В闆嗗悎榪涜媯鏌ワ紝鍚屾椂鑳藉淇濊瘉綆楁硶榪愯緇撴潫鏃跺彲浠ユ壘鍒版墍闇瑕佺殑瑙c傚洜姝わ紝榪欎簺鏂規硶閫氬父鑳藉鐢ㄦ潵姹傝В瑙勬ā寰堝ぇ鐨勯棶棰樸?br />綆楁硶鎬濇兂<br />鍥炴函(backtracking錛夋槸涓縐嶇郴緇熷湴鎼滅儲闂瑙g瓟鐨勬柟娉曘備負浜嗗疄鐜板洖婧紝棣栧厛闇瑕佷負闂瀹氫箟涓涓В絀洪棿(solution space錛夛紝榪欎釜絀洪棿蹇呴』鑷沖皯鍖呭惈闂鐨勪竴涓В(鍙兘鏄渶浼樼殑錛夈?br />涓嬩竴姝ユ槸緇勭粐瑙g┖闂翠互渚垮畠鑳借瀹規槗鍦版悳绱€傚吀鍨嬬殑緇勭粐鏂規硶鏄浘(榪峰闂)鎴栨爲(N鐨囧悗闂)銆?br />涓鏃﹀畾涔変簡瑙g┖闂寸殑緇勭粐鏂規硶錛岃繖涓┖闂村嵆鍙寜娣卞害浼樺厛鐨勬柟娉曚粠寮濮嬭妭鐐硅繘琛屾悳绱€?br /><br />鍥炴函鏂規硶鐨勬楠ゅ涓嬶細<br />1) 瀹氫箟涓涓В絀洪棿錛屽畠鍖呭惈闂鐨勮В銆?br />2) 鐢ㄩ備簬鎼滅儲鐨勬柟寮忕粍緇囪絀洪棿銆?br />3) 鐢ㄦ繁搴︿紭鍏堟硶鎼滅儲璇ョ┖闂達紝鍒╃敤闄愮晫鍑芥暟閬垮厤縐誨姩鍒頒笉鍙兘浜х敓瑙g殑瀛愮┖闂淬?br />鍥炴函綆楁硶鐨勪竴涓湁瓚g殑鐗規ф槸鍦ㄦ悳绱㈡墽琛岀殑鍚屾椂浜х敓瑙g┖闂淬傚湪鎼滅儲鏈熼棿鐨勪換浣曟椂鍒伙紝浠呬繚鐣欎粠寮濮嬭妭鐐瑰埌褰撳墠鑺傜偣鐨勮礬寰勩傚洜姝わ紝鍥炴函綆楁硶鐨勭┖闂撮渶姹備負O(浠庡紑濮嬭妭鐐硅搗鏈闀胯礬寰勭殑闀垮害錛夈傝繖涓壒鎬ч潪甯擱噸瑕侊紝鍥犱負瑙g┖闂寸殑澶у皬閫氬父鏄渶闀胯礬寰勯暱搴︾殑鎸囨暟鎴栭樁涔樸傛墍浠ュ鏋滆瀛樺偍鍏ㄩ儴瑙g┖闂寸殑璇濓紝鍐嶅鐨勭┖闂翠篃涓嶅鐢ㄣ?br /><br />綆楁硶搴旂敤<br />鍥炴函綆楁硶鐨勬眰瑙h繃紼嬪疄璐ㄤ笂鏄竴涓厛搴忛亶鍘嗕竴媯?鐘舵佹爲"鐨勮繃紼?鍙槸榪欐5鏍戜笉鏄亶鍘嗗墠棰勫厛寤虹珛鐨?鑰屾槸闅愬惈鍦ㄩ亶鍘嗚繃紼嬩腑<<鏁版嵁緇撴瀯>>(涓ヨ敋鏁?.<br /><br />鍥炴函綆楁硶鐨勫熀鏈濇兂鏄細浠庝竴鏉¤礬寰鍓嶈蛋錛岃兘榪涘垯榪涳紝涓嶈兘榪涘垯閫鍥炴潵錛屾崲涓鏉¤礬鍐嶈瘯銆?br /><br />鍥炴函娉曟槸涓涓棦甯︽湁緋葷粺鎬у張甯︽湁璺寵穬鎬х殑鎼滅儲綆楁硶銆傚畠鍦ㄥ寘鍚棶棰樼殑鎵鏈夎В鐨勮В絀洪棿鏍戜腑錛屾寜鐓ф繁搴︿紭鍏堢殑絳栫暐錛屼粠鏍圭粨鐐瑰嚭鍙戞悳绱㈣В鐨勭┖闂存爲銆傜畻娉曟悳绱㈣嚦瑙g殑絀洪棿鏍戠殑浠諱竴緇撶偣鏃訛紝鎬繪槸鍏堝垽鏂緇撶偣鏄惁鑲畾涓嶅寘鍚棶棰樼殑瑙c傚鏋滆偗瀹氫笉鍖呭惈錛屽垯璺寵繃瀵逛互璇ョ粨鐐逛負鏍圭殑瀛愭爲鐨勭郴緇熸悳绱紝閫愬眰鍚戝叾紲栧厛緇撶偣鍥炴函銆傚惁鍒欙紝榪涘叆璇ュ瓙鏍戯紝緇х畫鎸夋繁搴︿紭鍏堢殑絳栫暐榪涜鎼滅儲銆傚洖婧硶鍦ㄧ敤鏉ユ眰闂鐨勬墍鏈夎В鏃訛紝瑕佸洖婧埌鏍癸紝涓旀牴緇撶偣鐨勬墍鏈夊瓙鏍戦兘宸茶鎼滅儲閬嶆墠緇撴潫銆傝屽洖婧硶鍦ㄧ敤鏉ユ眰闂鐨勪換涓瑙f椂錛屽彧瑕佹悳绱㈠埌闂鐨勪竴涓В灝卞彲浠ョ粨鏉熴傝繖縐嶄互娣卞害浼樺厛鐨勬柟寮忕郴緇熷湴鎼滅儲闂鐨勮В鐨勭畻娉曠О涓哄洖婧硶錛屽畠閫傜敤浜庤В涓浜涚粍鍚堟暟杈冨ぇ鐨勯棶棰樸?br /><br />綆楁硶妗嗘灦錛?br /><br />1銆侀棶棰樼殑瑙g┖闂達細搴旂敤鍥炴函娉曡В闂鏃訛紝棣栧厛搴旀槑紜畾涔夐棶棰樼殑瑙g┖闂淬傞棶棰樼殑瑙g┖闂村簲鑷沖皯鍖呭惈涓涓?鏈浼橈級瑙c?br /><br />2銆佸洖婧硶鐨勫熀鏈濇兂錛氱‘瀹氫簡瑙g┖闂寸殑緇勭粐緇撴瀯鍚庯紝鍥炴函娉曞氨浠庡紑濮嬬粨鐐?鏍圭粨鐐癸級鍑哄彂錛屼互娣卞害浼樺厛鐨勬柟寮忔悳绱㈡暣涓В絀洪棿錛岃繖涓紑濮嬬粨鐐瑰氨鎴愪負涓涓椿緇撶偣錛屽悓鏃朵篃鎴愪負褰撳墠鐨勬墿灞曠粨鐐廣傚湪褰撳墠鐨勬墿灞曠粨鐐瑰錛屾悳绱㈠悜綰墊繁鏂瑰悜縐昏嚦涓涓柊緇撶偣錛岃繖涓柊緇撶偣灝辨垚涓轟竴涓柊鐨勬椿緇撶偣錛屽茍鎴愪負褰撳墠鎵╁睍緇撶偣銆傚鏋滃湪褰撳墠鐨勬墿灞曠粨鐐瑰涓嶈兘鍐嶅悜綰墊繁鏂瑰悜縐誨姩錛屽垯褰撳墠鎵╁睍緇撶偣灝辨垚涓烘緇撶偣銆傛崲鍙ヨ瘽璇達紝榪欎釜緇撶偣涓嶅啀鏄竴涓椿緇撶偣銆傛鏃訛紝搴斿線鍥炵Щ鍔?鍥炴函錛夎嚦鏈榪戠殑涓涓椿緇撶偣澶勶紝騫朵嬌榪欎釜媧葷粨鐐規垚涓哄綋鍓嶇殑鎵╁睍緇撶偣銆傚洖婧硶鍗充互榪欑宸ヤ綔鏂瑰紡閫掑綊鍦板湪瑙g┖闂翠腑鎼滅儲錛岀洿鑷蟲壘鍒版墍瑕佹眰鐨勮В鎴栬В絀洪棿涓凡娌℃湁媧葷粨鐐規椂涓烘銆?br /><br />榪愮敤鍥炴函娉曡В棰橀氬父鍖呭惈浠ヤ笅涓変釜姝ラ錛?br /><br />(1錛夐拡瀵規墍緇欓棶棰橈紝瀹氫箟闂鐨勮В絀洪棿錛?br /><br />(2錛夌‘瀹氭槗浜庢悳绱㈢殑瑙g┖闂寸粨鏋勶紱<br /><br />(3錛変互娣卞害浼樺厛鐨勬柟寮忔悳绱㈣В絀洪棿錛屽茍涓斿湪鎼滅儲榪囩▼涓敤鍓灊鍑芥暟閬垮厤鏃犳晥鎼滅儲銆?br /><br />3銆侀掑綊鍥炴函錛氱敱浜庡洖婧硶鏄瑙g殑絀洪棿鐨勬繁搴︿紭鍏堟悳绱紝鍥犳鍦ㄤ竴鑸儏鍐典笅鍙敤閫掑綊鍑芥暟鏉ュ疄鐜板洖婧硶濡備笅錛?br /><br />void backtrace(int i)<br />{<br />    for (int j=涓嬬晫;j<涓婄晫;j++)<br />    {<br />        matrix[i] = j;<br /><br />        //鍙{婊¤凍闄愮晫鍑芥暟鍜岀害鏉熸潯浠秨<br />        if ( 鍙())<br />        {<br />            //緗?br />            if (i>n)<br />            {<br />                //涓鎼滅儲騫惰緭鍑虹粨鏋?<br />            }<br />            backtrace(i+1);<br />        }<br />    }<br />}<br /><br />璇存槑錛?br /><br />i鏄掑綊娣卞害錛?br /><br />n鏄繁搴︽帶鍒訛紝鍗寵В絀洪棿鏍戠殑楂樺害錛?br /><br />鍙鎬у垽鏂湁涓ゆ柟闈㈢殑鍐呭錛?br /><br />①涓嶆弧綰︽潫鏉′歡鍒欏壀鍘葷浉搴斿瓙鏍戯紱<br /><br />②鑻ラ檺鐣屽嚱鏁拌秺鐣岋紝涔熷壀鍘葷浉搴斿瓙鏍戯紱<br /><br />③涓よ呭潎婊¤凍鍒欒繘鍏ヤ笅涓灞傦紱<br /><br />鎼滅儲錛氬叏闈㈣闂墍鏈夊彲鑳界殑鎯呭喌錛屽垎涓轟袱縐嶏細涓嶈冭檻緇欏畾闂鐨勭壒鏈夋ц川錛屾寜浜嬪厛璁懼ソ鐨勯『搴忥紝渚濇榪愮敤瑙勫垯錛屽嵆鐩茬洰鎼滅儲鐨勬柟娉曪紱鍙︿竴縐嶅垯鑰冭檻闂緇欏畾鐨勭壒鏈夋ц川錛岄夌敤鍚堥傜殑瑙勫垯錛屾彁楂樻悳绱㈢殑鏁堢巼錛屽嵆鍚彂寮忕殑鎼滅儲銆?br /><br /></span><span style="color: #008000">*/</span><span style="color: #000000"><br /><br /><br /></span><span style="color: #008000">//</span><span style="color: #008000">鍏殗鍚庨棶棰?br /></span><span style="color: #008000">//</span><span style="color: #008000">瑙g┖闂?/span><span style="color: #008000"><br /></span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> matirx[</span><span style="color: #000000">8</span><span style="color: #000000">] </span><span style="color: #000000">=</span><span style="color: #000000"> {</span><span style="color: #000000">0</span><span style="color: #000000">}; <br /></span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> count </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;  <br /><br /></span><span style="color: #0000ff">void</span><span style="color: #000000"> display()  <br />{  <br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> row;  <br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> col;  <br /><br />    printf(</span><span style="color: #000000">"</span><span style="color: #000000">\r\n======%02d=======\n</span><span style="color: #000000">"</span><span style="color: #000000">,count);  <br />    </span><span style="color: #0000ff">for</span><span style="color: #000000">(row </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; row </span><span style="color: #000000"><</span><span style="color: #000000">8</span><span style="color: #000000">; row </span><span style="color: #000000">++</span><span style="color: #000000">)<br />    {  <br />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(col </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; col </span><span style="color: #000000"><</span><span style="color: #000000"> matirx[row]; col </span><span style="color: #000000">++</span><span style="color: #000000">)  <br />            printf(</span><span style="color: #000000">"</span><span style="color: #000000">* </span><span style="color: #000000">"</span><span style="color: #000000">);  <br /><br />        printf(</span><span style="color: #000000">"</span><span style="color: #000000"># </span><span style="color: #000000">"</span><span style="color: #000000">);  <br /><br />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(col </span><span style="color: #000000">=</span><span style="color: #000000"> matirx[row] </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">; col </span><span style="color: #000000"><</span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">; col </span><span style="color: #000000">++</span><span style="color: #000000">)  <br />            printf(</span><span style="color: #000000">"</span><span style="color: #000000">* </span><span style="color: #000000">"</span><span style="color: #000000">);  <br /><br />        printf(</span><span style="color: #000000">"</span><span style="color: #000000">\n</span><span style="color: #000000">"</span><span style="color: #000000">);  <br />    }<br />}  <br /><br /></span><span style="color: #0000ff">bool</span><span style="color: #000000"> place(</span><span style="color: #0000ff">int</span><span style="color: #000000"> row, </span><span style="color: #0000ff">int</span><span style="color: #000000"> col)  <br />{  <br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> prev;  <br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> data;  <br /><br />    </span><span style="color: #0000ff">for</span><span style="color: #000000">(prev </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; prev </span><span style="color: #000000"><</span><span style="color: #000000"> row; prev </span><span style="color: #000000">++</span><span style="color: #000000">){  <br />        data </span><span style="color: #000000">=</span><span style="color: #000000"> matirx[prev];<br /><br />        </span><span style="color: #008000">//</span><span style="color: #008000">鍚屼竴鍒?/span><span style="color: #008000"><br /></span><span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000">(col </span><span style="color: #000000">==</span><span style="color: #000000"> data)  <br />            </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">; <br /><br />        </span><span style="color: #008000">//</span><span style="color: #008000">宸︽枩綰?/span><span style="color: #008000"><br /></span><span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000"> ((prev</span><span style="color: #000000">-</span><span style="color: #000000">row) </span><span style="color: #000000">==</span><span style="color: #000000"> (col </span><span style="color: #000000">-</span><span style="color: #000000"> data) )<br />            </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">; <br /><br />        </span><span style="color: #008000">//</span><span style="color: #008000">鍙蟲枩綰?/span><span style="color: #008000"><br /></span><span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000">((row </span><span style="color: #000000">-</span><span style="color: #000000"> prev) </span><span style="color: #000000">==</span><span style="color: #000000"> (col </span><span style="color: #000000">-</span><span style="color: #000000"> data))  <br />            </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;<br /><br />    }  <br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">true</span><span style="color: #000000">;  <br />}  <br /><br /></span><span style="color: #0000ff">void</span><span style="color: #000000"> queen(</span><span style="color: #0000ff">int</span><span style="color: #000000"> row)<br />{<br />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> col;<br /><br />    </span><span style="color: #0000ff">for</span><span style="color: #000000">(col</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;col</span><span style="color: #000000"><</span><span style="color: #000000">8</span><span style="color: #000000">;col</span><span style="color: #000000">++</span><span style="color: #000000">) <br />    {<br />        </span><span style="color: #0000ff">if</span><span style="color: #000000">(place(row,col)) <br />        {<br />            matirx[row]</span><span style="color: #000000">=</span><span style="color: #000000">col;<br />            </span><span style="color: #0000ff">if</span><span style="color: #000000">(row</span><span style="color: #000000">>=</span><span style="color: #000000">7</span><span style="color: #000000">) <br />            {<br />                count</span><span style="color: #000000">++</span><span style="color: #000000">,display();<br />                </span><span style="color: #008000">//</span><span style="color: #008000">matirx[row]=0;</span><span style="color: #008000"><br /></span><span style="color: #000000">                </span><span style="color: #0000ff">return</span><span style="color: #000000">;<br />            }<br /><br />            queen(row</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">);<br />            </span><span style="color: #008000">//</span><span style="color: #008000">matirx[row]=0;</span><span style="color: #008000"><br /></span><span style="color: #000000">        }<br />    }<br />}<br /><br /><br /></span><span style="color: #0000ff">int</span><span style="color: #000000"> main(</span><span style="color: #0000ff">void</span><span style="color: #000000">)<br />{<br />    queen(</span><span style="color: #000000">0</span><span style="color: #000000">);<br />    system(</span><span style="color: #000000">"</span><span style="color: #000000">pause</span><span style="color: #000000">"</span><span style="color: #000000">);<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />}<br /></span></div><img src ="http://www.shnenglu.com/aaxron/aggbug/198631.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-20 15:37 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/20/198631.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>綆楁硶錛氭暟瀛︾煡璇嗭紙1錛?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/19/198593.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Tue, 19 Mar 2013 09:48:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/19/198593.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198593.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/19/198593.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198593.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198593.html</trackback:ping><description><![CDATA[<p> </p> <p>鎺掑垪緇勫悎<br />鎺掑垪鐨勫畾涔夊強鍏惰綆楀叕寮忥細浠巒涓笉鍚屽厓绱犱腑錛屼換鍙杕(m≤n,m涓巒鍧囦負鑷劧鏁?涓嬪悓)涓厓绱犳寜鐓т竴瀹氱殑欏哄簭鎺掓垚涓鍒楋紝鍙仛浠巒涓笉鍚屽厓绱犱腑鍙栧嚭m涓厓绱犵殑涓涓帓鍒楋紱</p> <p>浠巒涓笉鍚屽厓绱犱腑鍙栧嚭m(m≤n)涓厓绱犵殑鎵鏈夋帓鍒楃殑涓暟錛屽彨鍋氫粠n涓笉鍚屽厓绱犱腑鍙栧嚭m涓厓绱犵殑鎺掑垪鏁幫紝鐢ㄧ鍙?A(n,m)琛ㄧず銆侫(n,m)=n(n-1)(n-2)……(n-m+1)= n!/(n-m)! 姝ゅ瑙勫畾0!=1</p> <p>A(n,m) = n!/(n-m)!<br /></p> <p><br /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 30px; display: inline !important; font: 14px/25px arial, 瀹嬩綋, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">浠巒涓笉鍚屽厓绱犱腑浠誨彇m錛坢≤n錛変釜鍏冪礌錛屾寜鐓т竴瀹氱殑欏哄簭鎺掑垪璧鋒潵錛屽彨鍋氫粠n涓笉鍚屽厓绱犱腑鍙栧嚭m涓厓绱犵殑涓涓帓鍒椼傚綋m=n鏃舵墍鏈夌殑鎺掑垪鎯呭喌鍙叏鎺掑垪銆?/span><br /><br /><br />緇勫悎鐨勫畾涔夊強鍏惰綆楀叕寮忥細浠巒涓笉鍚屽厓绱犱腑錛屼換鍙杕(m≤n)涓厓绱犲茍鎴愪竴緇勶紝鍙仛浠巒涓笉鍚屽厓绱犱腑鍙栧嚭m涓厓绱犵殑涓涓粍鍚堬紱浠巒涓笉鍚屽厓绱犱腑鍙栧嚭m(m≤n)涓厓绱犵殑鎵鏈夌粍鍚堢殑涓暟錛屽彨鍋氫粠n涓笉鍚屽厓绱犱腑鍙栧嚭m涓厓绱犵殑緇勫悎鏁般傜敤絎﹀彿 C(n,m) 琛ㄧず銆侰(n,m)==A(n,m)/m!錛汣(n,m)=C(n,n-m)銆?n>=m)</p> <p>鎺掑垪鏁幫細<br />A(n,m) = n!/(n-m)!</p> <p>緇勫悎鏁幫細<br />C(n,m)=A(n,m)/m!<br />C(n,m)=n!/(n-m)/m!<br /><br /><br /><br /><br />閽堝涓涓泦鍚坣錛岃繛緇瓙闆嗗悎<br />E(n) = n*(1+n)/2<br /><br /><br /></p><br /><br /> <p><img border="0" alt="" src="http://www.shnenglu.com/images/cppblog_com/aaxron/鏁板瓧鐭ヨ瘑.jpg" width="874" longdesc="" height="620" /></p><img src ="http://www.shnenglu.com/aaxron/aggbug/198593.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-19 17:48 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/19/198593.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍔ㄦ佽鍒掔畻娉曪紙2錛夛紝lcs綆楁硶錛屾敼榪涚┖闂村鏉傚害http://www.shnenglu.com/aaxron/archive/2013/03/16/198491.html澶╀笅澶╀笅Sat, 16 Mar 2013 10:17:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/16/198491.htmlhttp://www.shnenglu.com/aaxron/comments/198491.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/16/198491.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198491.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198491.htmlconst string LCS2(const string& strX,const string& strY)
{
    
int xlen=strX.size(); //妯悜闀垮害
    int ylen=strY.size(); //綰靛悜闀垮害
    vector<int> arr(ylen); //褰撳墠琛?/span>
    
    
int length=0;         //鐭╅樀鍏冪礌涓殑鏈澶у?/span>
    int pos=0;             //鐭╅樀鍏冪礌鏈澶у煎嚭鐜板湪絎嚑鍒?/span>
    arr.assign(ylen,0);
    
for(int x=0;x<xlen;x++
    {
        
for(int y=0;y<ylen;y++)
        {
            
if (strX.at(x)==strY.at(y))
            {
                
if(y==0)
                    arr[y]
=1;
                
else
                    arr[y]
=arr[y-1]+1;
                
if(arr[y]>length)
                {
                    length
=arr[y];
                    pos
=y;
                }
            } 
        }
    }
    
string res=strY.substr(pos-length+1,length);
    
return res;
}


澶╀笅 2013-03-16 18:17 鍙戣〃璇勮
]]>
鍔ㄦ佽鍒掔畻娉曪紙1錛夛細lcs綆楁硶http://www.shnenglu.com/aaxron/archive/2013/03/16/198487.html澶╀笅澶╀笅Sat, 16 Mar 2013 05:58:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/16/198487.htmlhttp://www.shnenglu.com/aaxron/comments/198487.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/16/198487.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198487.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198487.html#include "stdafx.h"

/*
姹備袱涓瓧絎︿覆鐨勬渶澶у叕鍏卞瓙涓茬殑闂錛堢畝瑕佽鏄庯紝浠庡彟澶栦竴涓湴鏂硅漿鐨勶紝鍜屼笅闈竴綃囧悎鎴愬湪涓璧鳳級錛?br />鎶婂瓧絎︿覆1錛堥暱搴錛夋í鎺掞紝涓?錛堥暱搴錛夌珫鎺掞紝寰楀埌涓涓猰×n鐨勭煩闃礳錛岀煩闃電殑姣忎釜鍏冪礌鐨勫煎涓嬶紝濡傛灉m[i]=n[j]錛屽垯c[j][i]=1,鍚﹀垯錛宑[j][i]=0銆傜劧鍚庢壘鍑虹煩闃典腑榪炵畫鏄?鐨勫瑙掔嚎鏈闀跨殑涓涓紝鍒欏瑙掔嚎鐨勯暱搴﹀氨鏄叕鍏卞瓙涓茬殑闀垮害.


LCS闂灝辨槸姹備袱涓瓧絎︿覆鏈闀垮叕鍏卞瓙涓茬殑闂銆傝В娉曞氨鏄敤涓涓煩闃墊潵璁板綍涓や釜瀛楃涓蹭腑鎵鏈変綅緗殑涓や釜瀛楃涔嬮棿鐨勫尮閰嶆儏鍐碉紝鑻ユ槸鍖歸厤鍒欎負1錛屽惁鍒欎負0銆傜劧鍚庢眰鍑哄瑙掔嚎鏈闀跨殑1搴忓垪錛屽叾瀵瑰簲鐨勪綅緗氨鏄渶闀垮尮閰嶅瓙涓茬殑浣嶇疆銆?nbsp;

涓嬮潰鏄瓧絎︿覆babhbxbhhaahbz鍜屽瓧絎︿覆hababhbbhzzx鐨勫尮閰嶇煩闃碉紝鍓嶈呬負X鏂瑰悜鐨勶紝鍚庤呬負Y鏂瑰悜鐨勩備笉闅炬壘鍒幫紝綰㈣壊閮ㄥ垎鏄渶闀跨殑鍖歸厤瀛愪覆銆傞氳繃鏌ユ壘浣嶇疆鎴戜滑寰楀埌鏈闀跨殑鍖歸厤瀛愪覆涓猴細babhb 


0 0 0 1 0 0 0 1 1 0 0 1 0 0 0
0 1 0 0 0 0 0 0 0 1 1 0 0 0 0         
1 0 1 0 1 0 1 0 0 0 0 0 1 0 0         
0 1 0 0 0 0 0 0 0 1 1 0 0 0 0         
1 0 1 0 1 0 1 0 0 0 0 0 1 0 0         
0 0 0 1 0 0 0 1 1 0 0 1 0 0 0         
1 0 1 0 1 0 1 0 0 0 0 0 1 0 0         
1 0 1 0 1 0 1 0 0 0 0 0 1 0 0         
0 0 0 1 0 0 0 1 1 0 0 1 0 0 0         
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0         
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0         
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0         
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0         

浣嗘槸鍦?鍜?鐨勭煩闃典腑鎵炬渶闀跨殑1瀵硅綰垮簭鍒楀張瑕佽姳鍘諱竴瀹氱殑鏃墮棿銆?br />閫氳繃鏀硅繘鐭╅樀鐨勭敓鎴愭柟寮忓拰璁劇疆鏍囪鍙橀噺錛屽彲浠ョ渷鍘昏繖閮ㄥ垎鏃墮棿銆?br />涓嬮潰鏄柊鐨勭煩闃電敓鎴愭柟寮忥細 
0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 
0 1 0 0 0 0 0 0 0 2 1 0 0 0 0 
1 0 2 0 1 0 1 0 0 0 0 0 1 0 0 
0 2 0 0 0 0 0 0 0 1 1 0 0 0 0 
1 0 3 0 1 0 1 0 0 0 0 0 1 0 0 
0 0 0 4 0 0 0 2 1 0 0 1 0 0 0 
1 0 1 0 5 0 1 0 0 0 0 0 2 0 0 
1 0 1 0 1 0 1 0 0 0 0 0 1 0 0 
0 0 0 2 0 0 0 2 1 0 0 1 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

涓嶇敤澶氳錛屼綘澶ф宸茬粡鐪嬪嚭鏉ヤ簡銆傚綋瀛楃鍖歸厤鐨勬椂鍊欙紝鎴戜滑騫朵笉鏄畝鍗曠殑緇欑浉搴斿厓绱犺祴涓?錛岃屾槸璧嬩笂鍏跺乏涓婅鍏冪礌鐨勫煎姞涓銆傛垜浠敤涓や釜鏍囪鍙橀噺鏉ユ爣璁扮煩闃典腑鍊兼渶澶х殑鍏冪礌鐨勪綅緗紝鍦ㄧ煩闃電敓鎴愮殑榪囩▼涓潵鍒ゆ柇褰撳墠鐢熸垚鐨勫厓绱犵殑鍊兼槸涓嶆槸鏈澶х殑錛屾嵁姝ゆ潵鏀瑰彉鏍囪鍙橀噺鐨勫鹼紝閭d箞鍒扮煩闃靛畬鎴愮殑鏃跺欙紝鏈闀垮尮閰嶅瓙涓茬殑浣嶇疆鍜岄暱搴﹀氨宸茬粡鍑烘潵浜嗐?nbsp;

榪欐牱鍋氶熷害姣旇緝蹇紝浣嗘槸鑺辯殑絀洪棿澶銆?nbsp;

*/

char* lcs(char *str1, char *str2,int* p_length)
{
    
int i,j,m,n,length,x,y;

    m 
= strlen(str1)+1;
    n 
= strlen(str2)+1;
    
int **matrix = new int*[m];
    
for(i = 0; i < m; i++)
        matrix[i] 
= new int[n];
    
for(i = 0; i < m; i++)
        matrix[i][
0]=0;//絎?鍒楅兘鍒濆鍖栦負0
    for(j = 0; j < n; j++)
        matrix[
0][j]=0;//絎?琛岄兘鍒濆鍖栦負0 

    length 
= -1;
    
*p_length = -1;

    
for(i = 1 ; i < m ; i++)
    {
        
for(j = 1; j < n; j++)
        {
            
if(str1[i-1]==str2[j-1])
            {
                
//鍙渶瑕佽窡宸︿笂鏂圭殑matrix[i-1][j-1]姣旇緝灝卞彲浠ヤ簡
                matrix[i][j]=matrix[i-1][j-1]+1;
            }
            
else
                
//涓嶈繛緇殑鏃跺欒繕瑕佽窡宸﹁竟鐨刴atrix[i][j-1]銆佷笂杈圭殑matrix[i-1][j]鍊兼瘮杈冿紝榪欓噷涓嶉渶瑕?nbsp;   
                matrix[i][j]=0;
            }
            
if(matrix[i][j]>length)
            {
                length
=matrix[i][j];
                x
=i;
                y
=j;
            }
        }
    }

    
for(i = 0; i < m; i++)
        delete[] matrix[i];
    delete[] matrix;

    
if (length>0)
    {
        
*p_length = length;
        
return &str1[x-length];
    }
    
return NULL;
}
int main(void)
{
    
char str1[1000],str2[1000],str3[1000];
    
int length;

    printf(
"璇瘋緭鍏ョ涓涓瓧絎︿覆錛?/span>");
    gets(str1);
    printf(
"璇瘋緭鍏ョ浜屼釜瀛楃涓詫細");
    gets(str2);
    
char* pszText = lcs(str1, str2,&length);
    printf(
"鏈闀垮叕鍏辮繛緇瓙涓茬殑闀垮害涓猴細%d\n",length);
    
if (pszText!=NULL)
    {
        strncpy(str3,pszText,length);
        str3[length] 
= 0;
        printf(
"鏈闀垮叕鍏辮繛緇瓙涓詫細%s\n",str3);
    }
    system(
"pause");
    
return 0;
}


澶╀笅 2013-03-16 13:58 鍙戣〃璇勮
]]>
CRC16綆楁硶http://www.shnenglu.com/aaxron/archive/2012/08/17/187451.html澶╀笅澶╀笅Fri, 17 Aug 2012 01:36:00 GMThttp://www.shnenglu.com/aaxron/archive/2012/08/17/187451.htmlhttp://www.shnenglu.com/aaxron/comments/187451.htmlhttp://www.shnenglu.com/aaxron/archive/2012/08/17/187451.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/187451.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/187451.html#include "stdafx.h"

unsigned 
int GetCrc32(char* pdata,unsigned int len){   
    
//鐢熸垚Crc32鐨勬煡璇㈣〃
    unsigned int Crc32Table[256]; 
    
int i,j;   
    unsigned 
int Crc;   
    
for (i = 0; i < 256; i++){   
        Crc 
= i;   
        
for (j = 0; j < 8; j++){   
            
if (Crc & 1)   
                Crc 
= (Crc >> 1^ 0xEDB88320;   
            
else  
                Crc 
>>= 1
        }   
        Crc32Table[i] 
= Crc;   
    }   
    
//寮濮嬭綆桟RC32鏍¢獙鍊?/span>
    Crc=0xffffffff;   
    
for(int i=0; i<len; i++)
    {     
        Crc 
= (Crc >> 8^ Crc32Table[(Crc & 0xFF^ pdata[i]];   
    }
    
    Crc 
^= 0xFFFFFFFF;
    
return Crc;   
}   

static const unsigned short Crc16Table[256= 
{                      
    
0x00000xC0C10xC1810x01400xC3010x03C00x02800xC241
    
0xC6010x06C00x07800xC7410x05000xC5C10xC4810x0440
    
0xCC010x0CC00x0D800xCD410x0F000xCFC10xCE810x0E40
    
0x0A000xCAC10xCB810x0B400xC9010x09C00x08800xC841
    
0xD8010x18C00x19800xD9410x1B000xDBC10xDA810x1A40
    
0x1E000xDEC10xDF810x1F400xDD010x1DC00x1C800xDC41
    
0x14000xD4C10xD5810x15400xD7010x17C00x16800xD641
    
0xD2010x12C00x13800xD3410x11000xD1C10xD0810x1040
    
0xF0010x30C00x31800xF1410x33000xF3C10xF2810x3240
    
0x36000xF6C10xF7810x37400xF5010x35C00x34800xF441
    
0x3C000xFCC10xFD810x3D400xFF010x3FC00x3E800xFE41
    
0xFA010x3AC00x3B800xFB410x39000xF9C10xF8810x3840
    
0x28000xE8C10xE9810x29400xEB010x2BC00x2A800xEA41
    
0xEE010x2EC00x2F800xEF410x2D000xEDC10xEC810x2C40
    
0xE4010x24C00x25800xE5410x27000xE7C10xE6810x2640
    
0x22000xE2C10xE3810x23400xE1010x21C00x20800xE041
    
0xA0010x60C00x61800xA1410x63000xA3C10xA2810x6240
    
0x66000xA6C10xA7810x67400xA5010x65C00x64800xA441
    
0x6C000xACC10xAD810x6D400xAF010x6FC00x6E800xAE41
    
0xAA010x6AC00x6B800xAB410x69000xA9C10xA8810x6840
    
0x78000xB8C10xB9810x79400xBB010x7BC00x7A800xBA41
    
0xBE010x7EC00x7F800xBF410x7D000xBDC10xBC810x7C40
    
0xB4010x74C00x75800xB5410x77000xB7C10xB6810x7640
    
0x72000xB2C10xB3810x73400xB1010x71C00x70800xB041
    
0x50000x90C10x91810x51400x93010x53C00x52800x9241
    
0x96010x56C00x57800x97410x55000x95C10x94810x5440
    
0x9C010x5CC00x5D800x9D410x5F000x9FC10x9E810x5E40
    
0x5A000x9AC10x9B810x5B400x99010x59C00x58800x9841
    
0x88010x48C00x49800x89410x4B000x8BC10x8A810x4A40
    
0x4E000x8EC10x8F810x4F400x8D010x4DC00x4C800x8C41,  
    
0x44000x84C10x85810x45400x87010x47C00x46800x8641
    
0x82010x42C00x43800x83410x41000x81C10x80810x4040 
};

//鐢熸垚Crc16鐨勬煡璇㈣〃
void GetCrc16Table()
{   
    unsigned 
short crc16tbl[256]; 
    unsigned 
int i,j;
    unsigned 
short Crc;
    printf(
"unsigned short Crc16Table[256] = \r\n{\r\n");
    
for (i = 0; i < 256; i++) {  
        Crc 
= i;   
        
for (j = 0; j < 8; j++) {   
            
if(Crc & 0x1)   
                Crc 
= (Crc >> 1^ 0xA001;   
            
else  
                Crc 
>>= 1
            
        }
        printf(
"0x%04X,",Crc);
        
if ((i+1)%8==0)
        {
            printf(
"\r\n");
        }
        crc16tbl[i] 
= Crc;
    }
    printf(
"};\r\n");
}
unsigned 
short GetCrc16(char* pdata,unsigned int len)
{   
    
//寮濮嬭綆桟RC16鏍¢獙鍊?/span>
    unsigned short crc16=0x0000;       
    
for(int i=0; i<len; i++){     
        crc16 
= (crc16 >> 8^ Crc16Table[(crc16 & 0xFF^ pdata[i]];  
    }
    
//Crc ^= 0x0000;  
    return crc16;   
}  

unsigned 
short GetCrc16(unsigned short poly,char* pdata,unsigned int len)
{   
    unsigned 
short crc16;   
    
//寮濮嬭綆桟RC16鏍¢獙鍊?/span>
    crc16=poly;       
    
for(int i=0; i<len; i++){     
        crc16 
= (crc16 >> 8^ Crc16Table[(crc16 & 0xFF^ pdata[i]];  
    }
    
//Crc ^= 0x0000;  
    return crc16;   
}

 

//test code
#include "stdafx.h"

int main( int argc,char* argv[] )
{
    
char str[]="iawene";
    unsigned 
short crc1 = 0;
    unsigned 
short crc2 = 0;
    GetCrc16Table();
    puts(
"\r\n\r\n\r\n-------------------------------------------");


    crc1
=GetCrc16(str,5);//0x5359
    printf("<1>0x%04X\n",crc1);
    
    
for(int i=0;i<5;i++)
    {
        crc2 
= GetCrc16(crc2,&str[i],1);
    }
    printf(
"<2>0x%04X\n",crc2);

    
    
return 0;
}


澶╀笅 2012-08-17 09:36 鍙戣〃璇勮
]]>
CRC32綆楁硶錛堟煡琛ㄦ硶錛変唬鐮?/title><link>http://www.shnenglu.com/aaxron/archive/2012/04/18/171890.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Wed, 18 Apr 2012 10:02:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2012/04/18/171890.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/171890.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2012/04/18/171890.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/171890.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/171890.html</trackback:ping><description><![CDATA[<div> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">#include </span><span style="color: #000000"><</span><span style="color: #000000">windows.h</span><span style="color: #000000">></span><span style="color: #000000"><br />#include </span><span style="color: #000000"><</span><span style="color: #000000">stdio.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><br /></span><span style="color: #0000ff">void</span><span style="color: #000000"> PrintCrcTable()<br />{<br />    </span><span style="color: #008000">//</span><span style="color: #008000">Poly = 0xedb88320 WinRAR Poly</span><span style="color: #008000"><br /></span><span style="color: #000000">    DWORD Val;<br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> (DWORD i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; i </span><span style="color: #000000"><</span><span style="color: #000000"> </span><span style="color: #000000">256</span><span style="color: #000000">; i</span><span style="color: #000000">++</span><span style="color: #000000">)<br />    {<br />        Val </span><span style="color: #000000">=</span><span style="color: #000000"> i;<br />        </span><span style="color: #0000ff">for</span><span style="color: #000000"> (DWORD k </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; k </span><span style="color: #000000"><</span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">; k</span><span style="color: #000000">++</span><span style="color: #000000">)<br />        {<br />            </span><span style="color: #0000ff">if</span><span style="color: #000000"> (Val </span><span style="color: #000000">&</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">)<br />                Val </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0xedb88320L</span><span style="color: #000000"> </span><span style="color: #000000">^</span><span style="color: #000000"> (Val </span><span style="color: #000000">>></span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">);<br />            </span><span style="color: #0000ff">else</span><span style="color: #000000"><br />                Val </span><span style="color: #000000">=</span><span style="color: #000000"> Val </span><span style="color: #000000">>></span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">;<br />        }<br />        printf (</span><span style="color: #000000">"</span><span style="color: #000000">0x%08x, </span><span style="color: #000000">"</span><span style="color: #000000">, Val);<br />        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #000000">0</span><span style="color: #000000"> </span><span style="color: #000000">==</span><span style="color: #000000"> ((i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">)</span><span style="color: #000000">%</span><span style="color: #000000">6</span><span style="color: #000000">))<br />            printf (</span><span style="color: #000000">"</span><span style="color: #000000">\n</span><span style="color: #000000">"</span><span style="color: #000000">);<br />    }<br />}<br /><br /><br /><br /></span><span style="color: #0000ff">const</span><span style="color: #000000"> DWORD Crc32Table[] </span><span style="color: #000000">=</span><span style="color: #000000"><br />{<br />    </span><span style="color: #000000">0x00000000</span><span style="color: #000000">, </span><span style="color: #000000">0x77073096</span><span style="color: #000000">, </span><span style="color: #000000">0xee0e612c</span><span style="color: #000000">, </span><span style="color: #000000">0x990951ba</span><span style="color: #000000">, </span><span style="color: #000000">0x076dc419</span><span style="color: #000000">, </span><span style="color: #000000">0x706af48f</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xe963a535</span><span style="color: #000000">, </span><span style="color: #000000">0x9e6495a3</span><span style="color: #000000">, </span><span style="color: #000000">0x0edb8832</span><span style="color: #000000">, </span><span style="color: #000000">0x79dcb8a4</span><span style="color: #000000">, </span><span style="color: #000000">0xe0d5e91e</span><span style="color: #000000">, </span><span style="color: #000000">0x97d2d988</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x09b64c2b</span><span style="color: #000000">, </span><span style="color: #000000">0x7eb17cbd</span><span style="color: #000000">, </span><span style="color: #000000">0xe7b82d07</span><span style="color: #000000">, </span><span style="color: #000000">0x90bf1d91</span><span style="color: #000000">, </span><span style="color: #000000">0x1db71064</span><span style="color: #000000">, </span><span style="color: #000000">0x6ab020f2</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xf3b97148</span><span style="color: #000000">, </span><span style="color: #000000">0x84be41de</span><span style="color: #000000">, </span><span style="color: #000000">0x1adad47d</span><span style="color: #000000">, </span><span style="color: #000000">0x6ddde4eb</span><span style="color: #000000">, </span><span style="color: #000000">0xf4d4b551</span><span style="color: #000000">, </span><span style="color: #000000">0x83d385c7</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x136c9856</span><span style="color: #000000">, </span><span style="color: #000000">0x646ba8c0</span><span style="color: #000000">, </span><span style="color: #000000">0xfd62f97a</span><span style="color: #000000">, </span><span style="color: #000000">0x8a65c9ec</span><span style="color: #000000">, </span><span style="color: #000000">0x14015c4f</span><span style="color: #000000">, </span><span style="color: #000000">0x63066cd9</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xfa0f3d63</span><span style="color: #000000">, </span><span style="color: #000000">0x8d080df5</span><span style="color: #000000">, </span><span style="color: #000000">0x3b6e20c8</span><span style="color: #000000">, </span><span style="color: #000000">0x4c69105e</span><span style="color: #000000">, </span><span style="color: #000000">0xd56041e4</span><span style="color: #000000">, </span><span style="color: #000000">0xa2677172</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x3c03e4d1</span><span style="color: #000000">, </span><span style="color: #000000">0x4b04d447</span><span style="color: #000000">, </span><span style="color: #000000">0xd20d85fd</span><span style="color: #000000">, </span><span style="color: #000000">0xa50ab56b</span><span style="color: #000000">, </span><span style="color: #000000">0x35b5a8fa</span><span style="color: #000000">, </span><span style="color: #000000">0x42b2986c</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xdbbbc9d6</span><span style="color: #000000">, </span><span style="color: #000000">0xacbcf940</span><span style="color: #000000">, </span><span style="color: #000000">0x32d86ce3</span><span style="color: #000000">, </span><span style="color: #000000">0x45df5c75</span><span style="color: #000000">, </span><span style="color: #000000">0xdcd60dcf</span><span style="color: #000000">, </span><span style="color: #000000">0xabd13d59</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x26d930ac</span><span style="color: #000000">, </span><span style="color: #000000">0x51de003a</span><span style="color: #000000">, </span><span style="color: #000000">0xc8d75180</span><span style="color: #000000">, </span><span style="color: #000000">0xbfd06116</span><span style="color: #000000">, </span><span style="color: #000000">0x21b4f4b5</span><span style="color: #000000">, </span><span style="color: #000000">0x56b3c423</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xcfba9599</span><span style="color: #000000">, </span><span style="color: #000000">0xb8bda50f</span><span style="color: #000000">, </span><span style="color: #000000">0x2802b89e</span><span style="color: #000000">, </span><span style="color: #000000">0x5f058808</span><span style="color: #000000">, </span><span style="color: #000000">0xc60cd9b2</span><span style="color: #000000">, </span><span style="color: #000000">0xb10be924</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x2f6f7c87</span><span style="color: #000000">, </span><span style="color: #000000">0x58684c11</span><span style="color: #000000">, </span><span style="color: #000000">0xc1611dab</span><span style="color: #000000">, </span><span style="color: #000000">0xb6662d3d</span><span style="color: #000000">, </span><span style="color: #000000">0x76dc4190</span><span style="color: #000000">, </span><span style="color: #000000">0x01db7106</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x98d220bc</span><span style="color: #000000">, </span><span style="color: #000000">0xefd5102a</span><span style="color: #000000">, </span><span style="color: #000000">0x71b18589</span><span style="color: #000000">, </span><span style="color: #000000">0x06b6b51f</span><span style="color: #000000">, </span><span style="color: #000000">0x9fbfe4a5</span><span style="color: #000000">, </span><span style="color: #000000">0xe8b8d433</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x7807c9a2</span><span style="color: #000000">, </span><span style="color: #000000">0x0f00f934</span><span style="color: #000000">, </span><span style="color: #000000">0x9609a88e</span><span style="color: #000000">, </span><span style="color: #000000">0xe10e9818</span><span style="color: #000000">, </span><span style="color: #000000">0x7f6a0dbb</span><span style="color: #000000">, </span><span style="color: #000000">0x086d3d2d</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x91646c97</span><span style="color: #000000">, </span><span style="color: #000000">0xe6635c01</span><span style="color: #000000">, </span><span style="color: #000000">0x6b6b51f4</span><span style="color: #000000">, </span><span style="color: #000000">0x1c6c6162</span><span style="color: #000000">, </span><span style="color: #000000">0x856530d8</span><span style="color: #000000">, </span><span style="color: #000000">0xf262004e</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x6c0695ed</span><span style="color: #000000">, </span><span style="color: #000000">0x1b01a57b</span><span style="color: #000000">, </span><span style="color: #000000">0x8208f4c1</span><span style="color: #000000">, </span><span style="color: #000000">0xf50fc457</span><span style="color: #000000">, </span><span style="color: #000000">0x65b0d9c6</span><span style="color: #000000">, </span><span style="color: #000000">0x12b7e950</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x8bbeb8ea</span><span style="color: #000000">, </span><span style="color: #000000">0xfcb9887c</span><span style="color: #000000">, </span><span style="color: #000000">0x62dd1ddf</span><span style="color: #000000">, </span><span style="color: #000000">0x15da2d49</span><span style="color: #000000">, </span><span style="color: #000000">0x8cd37cf3</span><span style="color: #000000">, </span><span style="color: #000000">0xfbd44c65</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x4db26158</span><span style="color: #000000">, </span><span style="color: #000000">0x3ab551ce</span><span style="color: #000000">, </span><span style="color: #000000">0xa3bc0074</span><span style="color: #000000">, </span><span style="color: #000000">0xd4bb30e2</span><span style="color: #000000">, </span><span style="color: #000000">0x4adfa541</span><span style="color: #000000">, </span><span style="color: #000000">0x3dd895d7</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xa4d1c46d</span><span style="color: #000000">, </span><span style="color: #000000">0xd3d6f4fb</span><span style="color: #000000">, </span><span style="color: #000000">0x4369e96a</span><span style="color: #000000">, </span><span style="color: #000000">0x346ed9fc</span><span style="color: #000000">, </span><span style="color: #000000">0xad678846</span><span style="color: #000000">, </span><span style="color: #000000">0xda60b8d0</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x44042d73</span><span style="color: #000000">, </span><span style="color: #000000">0x33031de5</span><span style="color: #000000">, </span><span style="color: #000000">0xaa0a4c5f</span><span style="color: #000000">, </span><span style="color: #000000">0xdd0d7cc9</span><span style="color: #000000">, </span><span style="color: #000000">0x5005713c</span><span style="color: #000000">, </span><span style="color: #000000">0x270241aa</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xbe0b1010</span><span style="color: #000000">, </span><span style="color: #000000">0xc90c2086</span><span style="color: #000000">, </span><span style="color: #000000">0x5768b525</span><span style="color: #000000">, </span><span style="color: #000000">0x206f85b3</span><span style="color: #000000">, </span><span style="color: #000000">0xb966d409</span><span style="color: #000000">, </span><span style="color: #000000">0xce61e49f</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x5edef90e</span><span style="color: #000000">, </span><span style="color: #000000">0x29d9c998</span><span style="color: #000000">, </span><span style="color: #000000">0xb0d09822</span><span style="color: #000000">, </span><span style="color: #000000">0xc7d7a8b4</span><span style="color: #000000">, </span><span style="color: #000000">0x59b33d17</span><span style="color: #000000">, </span><span style="color: #000000">0x2eb40d81</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xb7bd5c3b</span><span style="color: #000000">, </span><span style="color: #000000">0xc0ba6cad</span><span style="color: #000000">, </span><span style="color: #000000">0xedb88320</span><span style="color: #000000">, </span><span style="color: #000000">0x9abfb3b6</span><span style="color: #000000">, </span><span style="color: #000000">0x03b6e20c</span><span style="color: #000000">, </span><span style="color: #000000">0x74b1d29a</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xead54739</span><span style="color: #000000">, </span><span style="color: #000000">0x9dd277af</span><span style="color: #000000">, </span><span style="color: #000000">0x04db2615</span><span style="color: #000000">, </span><span style="color: #000000">0x73dc1683</span><span style="color: #000000">, </span><span style="color: #000000">0xe3630b12</span><span style="color: #000000">, </span><span style="color: #000000">0x94643b84</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x0d6d6a3e</span><span style="color: #000000">, </span><span style="color: #000000">0x7a6a5aa8</span><span style="color: #000000">, </span><span style="color: #000000">0xe40ecf0b</span><span style="color: #000000">, </span><span style="color: #000000">0x9309ff9d</span><span style="color: #000000">, </span><span style="color: #000000">0x0a00ae27</span><span style="color: #000000">, </span><span style="color: #000000">0x7d079eb1</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xf00f9344</span><span style="color: #000000">, </span><span style="color: #000000">0x8708a3d2</span><span style="color: #000000">, </span><span style="color: #000000">0x1e01f268</span><span style="color: #000000">, </span><span style="color: #000000">0x6906c2fe</span><span style="color: #000000">, </span><span style="color: #000000">0xf762575d</span><span style="color: #000000">, </span><span style="color: #000000">0x806567cb</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x196c3671</span><span style="color: #000000">, </span><span style="color: #000000">0x6e6b06e7</span><span style="color: #000000">, </span><span style="color: #000000">0xfed41b76</span><span style="color: #000000">, </span><span style="color: #000000">0x89d32be0</span><span style="color: #000000">, </span><span style="color: #000000">0x10da7a5a</span><span style="color: #000000">, </span><span style="color: #000000">0x67dd4acc</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xf9b9df6f</span><span style="color: #000000">, </span><span style="color: #000000">0x8ebeeff9</span><span style="color: #000000">, </span><span style="color: #000000">0x17b7be43</span><span style="color: #000000">, </span><span style="color: #000000">0x60b08ed5</span><span style="color: #000000">, </span><span style="color: #000000">0xd6d6a3e8</span><span style="color: #000000">, </span><span style="color: #000000">0xa1d1937e</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x38d8c2c4</span><span style="color: #000000">, </span><span style="color: #000000">0x4fdff252</span><span style="color: #000000">, </span><span style="color: #000000">0xd1bb67f1</span><span style="color: #000000">, </span><span style="color: #000000">0xa6bc5767</span><span style="color: #000000">, </span><span style="color: #000000">0x3fb506dd</span><span style="color: #000000">, </span><span style="color: #000000">0x48b2364b</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xd80d2bda</span><span style="color: #000000">, </span><span style="color: #000000">0xaf0a1b4c</span><span style="color: #000000">, </span><span style="color: #000000">0x36034af6</span><span style="color: #000000">, </span><span style="color: #000000">0x41047a60</span><span style="color: #000000">, </span><span style="color: #000000">0xdf60efc3</span><span style="color: #000000">, </span><span style="color: #000000">0xa867df55</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x316e8eef</span><span style="color: #000000">, </span><span style="color: #000000">0x4669be79</span><span style="color: #000000">, </span><span style="color: #000000">0xcb61b38c</span><span style="color: #000000">, </span><span style="color: #000000">0xbc66831a</span><span style="color: #000000">, </span><span style="color: #000000">0x256fd2a0</span><span style="color: #000000">, </span><span style="color: #000000">0x5268e236</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xcc0c7795</span><span style="color: #000000">, </span><span style="color: #000000">0xbb0b4703</span><span style="color: #000000">, </span><span style="color: #000000">0x220216b9</span><span style="color: #000000">, </span><span style="color: #000000">0x5505262f</span><span style="color: #000000">, </span><span style="color: #000000">0xc5ba3bbe</span><span style="color: #000000">, </span><span style="color: #000000">0xb2bd0b28</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x2bb45a92</span><span style="color: #000000">, </span><span style="color: #000000">0x5cb36a04</span><span style="color: #000000">, </span><span style="color: #000000">0xc2d7ffa7</span><span style="color: #000000">, </span><span style="color: #000000">0xb5d0cf31</span><span style="color: #000000">, </span><span style="color: #000000">0x2cd99e8b</span><span style="color: #000000">, </span><span style="color: #000000">0x5bdeae1d</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x9b64c2b0</span><span style="color: #000000">, </span><span style="color: #000000">0xec63f226</span><span style="color: #000000">, </span><span style="color: #000000">0x756aa39c</span><span style="color: #000000">, </span><span style="color: #000000">0x026d930a</span><span style="color: #000000">, </span><span style="color: #000000">0x9c0906a9</span><span style="color: #000000">, </span><span style="color: #000000">0xeb0e363f</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x72076785</span><span style="color: #000000">, </span><span style="color: #000000">0x05005713</span><span style="color: #000000">, </span><span style="color: #000000">0x95bf4a82</span><span style="color: #000000">, </span><span style="color: #000000">0xe2b87a14</span><span style="color: #000000">, </span><span style="color: #000000">0x7bb12bae</span><span style="color: #000000">, </span><span style="color: #000000">0x0cb61b38</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x92d28e9b</span><span style="color: #000000">, </span><span style="color: #000000">0xe5d5be0d</span><span style="color: #000000">, </span><span style="color: #000000">0x7cdcefb7</span><span style="color: #000000">, </span><span style="color: #000000">0x0bdbdf21</span><span style="color: #000000">, </span><span style="color: #000000">0x86d3d2d4</span><span style="color: #000000">, </span><span style="color: #000000">0xf1d4e242</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x68ddb3f8</span><span style="color: #000000">, </span><span style="color: #000000">0x1fda836e</span><span style="color: #000000">, </span><span style="color: #000000">0x81be16cd</span><span style="color: #000000">, </span><span style="color: #000000">0xf6b9265b</span><span style="color: #000000">, </span><span style="color: #000000">0x6fb077e1</span><span style="color: #000000">, </span><span style="color: #000000">0x18b74777</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x88085ae6</span><span style="color: #000000">, </span><span style="color: #000000">0xff0f6a70</span><span style="color: #000000">, </span><span style="color: #000000">0x66063bca</span><span style="color: #000000">, </span><span style="color: #000000">0x11010b5c</span><span style="color: #000000">, </span><span style="color: #000000">0x8f659eff</span><span style="color: #000000">, </span><span style="color: #000000">0xf862ae69</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x616bffd3</span><span style="color: #000000">, </span><span style="color: #000000">0x166ccf45</span><span style="color: #000000">, </span><span style="color: #000000">0xa00ae278</span><span style="color: #000000">, </span><span style="color: #000000">0xd70dd2ee</span><span style="color: #000000">, </span><span style="color: #000000">0x4e048354</span><span style="color: #000000">, </span><span style="color: #000000">0x3903b3c2</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xa7672661</span><span style="color: #000000">, </span><span style="color: #000000">0xd06016f7</span><span style="color: #000000">, </span><span style="color: #000000">0x4969474d</span><span style="color: #000000">, </span><span style="color: #000000">0x3e6e77db</span><span style="color: #000000">, </span><span style="color: #000000">0xaed16a4a</span><span style="color: #000000">, </span><span style="color: #000000">0xd9d65adc</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x40df0b66</span><span style="color: #000000">, </span><span style="color: #000000">0x37d83bf0</span><span style="color: #000000">, </span><span style="color: #000000">0xa9bcae53</span><span style="color: #000000">, </span><span style="color: #000000">0xdebb9ec5</span><span style="color: #000000">, </span><span style="color: #000000">0x47b2cf7f</span><span style="color: #000000">, </span><span style="color: #000000">0x30b5ffe9</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xbdbdf21c</span><span style="color: #000000">, </span><span style="color: #000000">0xcabac28a</span><span style="color: #000000">, </span><span style="color: #000000">0x53b39330</span><span style="color: #000000">, </span><span style="color: #000000">0x24b4a3a6</span><span style="color: #000000">, </span><span style="color: #000000">0xbad03605</span><span style="color: #000000">, </span><span style="color: #000000">0xcdd70693</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0x54de5729</span><span style="color: #000000">, </span><span style="color: #000000">0x23d967bf</span><span style="color: #000000">, </span><span style="color: #000000">0xb3667a2e</span><span style="color: #000000">, </span><span style="color: #000000">0xc4614ab8</span><span style="color: #000000">, </span><span style="color: #000000">0x5d681b02</span><span style="color: #000000">, </span><span style="color: #000000">0x2a6f2b94</span><span style="color: #000000">,<br />    </span><span style="color: #000000">0xb40bbe37</span><span style="color: #000000">, </span><span style="color: #000000">0xc30c8ea1</span><span style="color: #000000">, </span><span style="color: #000000">0x5a05df1b</span><span style="color: #000000">, </span><span style="color: #000000">0x2d02ef8d</span><span style="color: #000000"><br />};<br /><br />DWORD GenerateCrc32(DWORD PartialCrc,PUCHAR  Buffer,DWORD   Length)<br />{<br />    DWORD crc;<br />    DWORD i;<br /><br />    </span><span style="color: #008000">//</span><span style="color: #008000"> Generate the CRC32 checksum.</span><span style="color: #008000"><br /></span><span style="color: #000000">    crc </span><span style="color: #000000">=</span><span style="color: #000000"> PartialCrc </span><span style="color: #000000">^</span><span style="color: #000000"> </span><span style="color: #000000">0xffffffffL</span><span style="color: #000000">;<br /><br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> (i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; i </span><span style="color: #000000"><</span><span style="color: #000000"> Length; i</span><span style="color: #000000">++</span><span style="color: #000000">)<br />    {<br />        crc </span><span style="color: #000000">=</span><span style="color: #000000"> Crc32Table[(crc </span><span style="color: #000000">^</span><span style="color: #000000"> Buffer[i]) </span><span style="color: #000000">&</span><span style="color: #000000"> </span><span style="color: #000000">0xff</span><span style="color: #000000">] </span><span style="color: #000000">^</span><span style="color: #000000"> (crc </span><span style="color: #000000">>></span><span style="color: #000000"> </span><span style="color: #000000">8</span><span style="color: #000000">);<br />    }<br /><br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> (crc </span><span style="color: #000000">^</span><span style="color: #000000"> </span><span style="color: #000000">0xffffffffL</span><span style="color: #000000">);<br />}<br /><br /></span><span style="color: #008000">//</span><span style="color: #008000">嫻嬭瘯紼嬪簭</span><span style="color: #008000"><br /></span><span style="color: #0000ff">int</span><span style="color: #000000"> main(</span><span style="color: #0000ff">int</span><span style="color: #000000"> argc,</span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000"> argv[])<br />{<br />    </span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000"> szFileName </span><span style="color: #000000">=</span><span style="color: #000000"> NULL;<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (argc</span><span style="color: #000000"><</span><span style="color: #000000">2</span><span style="color: #000000">)<br />    {<br />        printf(</span><span style="color: #000000">"</span><span style="color: #000000">Usage:%s <filename> \r\n</span><span style="color: #000000">"</span><span style="color: #000000">,argv[</span><span style="color: #000000">0</span><span style="color: #000000">]);<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">;<br />    }<br />    szFileName </span><span style="color: #000000">=</span><span style="color: #000000"> argv[</span><span style="color: #000000">1</span><span style="color: #000000">];<br />    FILE </span><span style="color: #000000">*</span><span style="color: #000000">fp </span><span style="color: #000000">=</span><span style="color: #000000"> fopen(szFileName,</span><span style="color: #000000">"</span><span style="color: #000000">rb</span><span style="color: #000000">"</span><span style="color: #000000">);<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000">(NULL </span><span style="color: #000000">==</span><span style="color: #000000"> fp) <br />    {<br />        printf(</span><span style="color: #000000">"</span><span style="color: #000000">Open %s error:%d \r\n</span><span style="color: #000000">"</span><span style="color: #000000">,szFileName);<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />    }<br /><br />    DWORD crc32 </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />    BYTE c </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">while</span><span style="color: #000000">(</span><span style="color: #000000">1</span><span style="color: #000000"> </span><span style="color: #000000">==</span><span style="color: #000000"> fread(</span><span style="color: #000000">&</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,fp))<br />        crc32 </span><span style="color: #000000">=</span><span style="color: #000000"> GenerateCrc32(crc32,</span><span style="color: #000000">&</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">);<br /><br />    fclose(fp);<br /><br />    printf(</span><span style="color: #000000">"</span><span style="color: #000000">CRC32 = 0x%08X</span><span style="color: #000000">"</span><span style="color: #000000">, crc32);<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;<br />}</span></div></div><img src ="http://www.shnenglu.com/aaxron/aggbug/171890.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2012-04-18 18:02 <a href="http://www.shnenglu.com/aaxron/archive/2012/04/18/171890.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.wanghaochuju.cn" target="_blank">伊人久久大香线焦综合四虎</a>| <a href="http://www.lureng.cn" target="_blank">久久久久这里只有精品</a>| <a href="http://www.spbbs.cn" target="_blank">久久久久高潮综合影院</a>| <a href="http://www.mk606.cn" target="_blank">亚洲国产成人精品女人久久久</a>| <a href="http://www.7111393.cn" target="_blank">久久精品一区二区</a>| <a href="http://www.pc168.com.cn" target="_blank">精品一区二区久久</a>| <a href="http://www.srdwl.cn" target="_blank">91久久精品国产91性色也</a>| <a href="http://www.gnkk.net.cn" target="_blank">久久99国产精一区二区三区</a>| <a href="http://www.25552l.cn" target="_blank">1000部精品久久久久久久久</a>| <a href="http://www.020rj.cn" target="_blank">99精品久久精品</a>| <a href="http://www.yywhqy.cn" target="_blank">久久99精品久久久久久hb无码 </a>| <a href="http://www.1webproxy.cn" target="_blank">一本一本久久aa综合精品</a>| <a href="http://www.ynymdp.cn" target="_blank">伊人久久大香线蕉综合5g</a>| <a href="http://www.helloly.cn" target="_blank">一级女性全黄久久生活片免费</a>| <a href="http://www.shinehall.cn" target="_blank">日日狠狠久久偷偷色综合0</a>| <a href="http://www.digcm.cn" target="_blank">亚洲国产成人精品久久久国产成人一区二区三区综 </a>| <a href="http://www.gbpa.cn" target="_blank">久久93精品国产91久久综合</a>| <a href="http://www.grzzc358.cn" target="_blank">成人亚洲欧美久久久久</a>| <a href="http://www.xs258.cn" target="_blank">精品无码久久久久久久久久</a>| <a href="http://www.662z.cn" target="_blank">久久久中文字幕日本</a>| <a href="http://www.klzp.net.cn" target="_blank">美女久久久久久</a>| <a href="http://www.whoimi.cn" target="_blank">亚洲伊人久久综合影院</a>| <a href="http://www.wendalaw.com.cn" target="_blank">久久精品国产亚洲av麻豆图片 </a>| <a href="http://www.googledad.cn" target="_blank">久久午夜伦鲁片免费无码</a>| <a href="http://www.xcfsfl.cn" target="_blank">久久国产精品成人片免费</a>| <a href="http://www.292284.cn" target="_blank">久久精品国产精品青草</a>| <a href="http://www.voxj.cn" target="_blank">久久精品国产只有精品66 </a>| <a href="http://www.kuhaoma.cn" target="_blank">婷婷国产天堂久久综合五月</a>| <a href="http://www.ccka.cn" target="_blank">伊人久久综合精品无码AV专区</a>| <a href="http://www.jinxing168.net.cn" target="_blank">亚洲精品乱码久久久久久蜜桃图片 </a>| <a href="http://www.ts71.cn" target="_blank">日韩十八禁一区二区久久</a>| <a href="http://www.vyfx.cn" target="_blank">2019久久久高清456</a>| <a href="http://www.smxsj.cn" target="_blank">久久精品人成免费</a>| <a href="http://www.021cp.cn" target="_blank">激情久久久久久久久久</a>| <a href="http://www.ak14.cn" target="_blank">99久久国产亚洲综合精品</a>| <a href="http://www.hejz.cn" target="_blank">久久久噜噜噜久久熟女AA片</a>| <a href="http://www.a737.cn" target="_blank">国产精品亚洲综合专区片高清久久久 </a>| <a href="http://www.88815755.cn" target="_blank">久久久一本精品99久久精品88</a>| <a href="http://www.me239.cn" target="_blank">久久午夜电影网</a>| <a href="http://www.yy1122.cn" target="_blank">一级做a爰片久久毛片看看</a>| <a href="http://www.qushouji.cn" target="_blank">粉嫩小泬无遮挡久久久久久 </a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>