• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Brian Warehouse

            Some birds aren`t meant to be caged, their feathers are just too bright... ...
            posts - 40, comments - 16, trackbacks - 0, articles - 1

            這不是解題報告,只是偶然看到的,以此與君共勉!

            #include<stdio.h>
            unsigned short a[10002]={0,0,1,1,0,2,0,1,1,0,1,1,1,1,0,1,0,2,1,1,0,0,0,2,1,0,1,0,1,1,1,2,0,0,0,0,2,1,0,1,0,3,1,1,0,0,0,1,1,1,0,0,1,2,0,0,1,0,1,2,2,1,0,0,0,0,0,2,1,0,0,2,2,1,0,1,0,1,1,1,0,0,0,3,1,0,0,0,1,1,2,0,0,0,0,1,0,2,1,0,
            2,2,1,1,0,0,0,1,0,2,0,0,2,1,0,0,0,0,0,2,2,1,0,0,1,0,0,2,1,1,0,2,1,0,0,0,0,1,2,2,0,0,0,2,1,0,0,0,0,1,1,1,2,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,2,0,0,0,0,0,1,2,2,0,0,1,0,1,2,0,0,0,1,1,1,0,1,0,3,1,3,
            0,0,1,0,2,0,0,0,0,0,2,2,0,0,0,0,1,0,0,0,1,2,1,3,0,0,0,1,2,1,0,0,0,2,0,1,1,0,1,1,3,1,0,1,0,0,0,0,0,0,0,3,1,1,0,0,0,1,2,0,0,0,0,2,1,0,0,0,1,2,1,2,1,0,0,0,2,1,0,1,1,3,0,1,0,0,0,3,1,0,1,0,0,1,0,0,0,0,0,0,
            2,1,0,0,2,0,1,1,1,0,0,5,0,1,0,0,0,1,1,1,1,0,0,2,1,0,1,0,1,1,2,2,0,0,0,0,0,1,0,0,3,1,0,0,0,0,0,1,1,2,0,1,1,2,0,0,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,3,2,2,0,0,1,0,0,2,0,1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,1,0,0,0,1,1,1,1,0,0,1,1,1,0,1,3,0,1,1,0,2,1,0,2,1,1,0,1,0,1,0,1,1,2,0,2,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,2,0,0,2,0,1,3,0,0,1,1,2,1,0,2,1,1,1,1,0,1,0,3,0,0,0,1,0,0,0,
            1,1,0,2,0,0,0,1,0,0,1,1,0,1,1,0,1,2,0,1,1,0,0,3,0,1,0,1,0,2,2,2,0,1,0,0,0,0,0,0,0,0,0,1,1,0,2,2,1,1,1,0,0,0,1,0,0,2,0,2,1,2,0,0,2,0,0,1,0,1,1,0,1,0,0,0,0,2,1,1,0,0,0,0,0,0,0,0,1,1,2,0,1,0,2,1,1,2,0,1,
            2,1,0,0,0,1,0,1,0,0,0,0,0,1,0,2,1,0,1,1,0,1,0,0,0,1,3,0,0,0,0,0,1,2,0,0,1,1,1,1,0,0,0,1,1,0,0,1,3,1,1,1,0,0,1,1,0,1,0,0,1,1,0,0,0,1,2,1,2,2,0,0,0,2,1,0,0,1,0,1,0,1,0,0,1,2,0,2,0,0,0,1,1,0,0,0,1,1,0,0,
            2,0,0,1,1,1,0,0,1,2,1,1,1,1,1,0,0,1,0,0,0,0,0,0,1,0,3,1,1,3,1,0,1,1,0,1,0,1,1,3,0,1,0,0,1,1,1,0,0,1,2,1,2,1,1,0,0,1,2,2,0,0,0,1,1,2,1,0,1,1,1,2,1,0,0,0,1,0,0,1,2,0,0,2,0,0,0,2,0,1,0,0,0,0,1,0,0,0,0,1,
            0,2,0,0,0,1,0,3,1,0,1,0,2,0,1,2,0,0,0,0,2,1,1,1,2,0,0,0,0,2,0,1,0,0,0,1,1,1,0,1,0,1,1,0,0,0,0,0,3,2,0,0,0,1,0,2,0,1,1,1,1,0,0,0,1,0,0,1,2,0,2,2,0,1,1,0,1,0,1,1,1,0,0,2,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,
            0};
                   
            int main()
            {   
                int n;
                while(scanf("%d",&n),n)
                {
                    printf("%d\n",a[n]);   
                }     
            }

            posted @ 2010-08-17 13:55 Brian 閱讀(353) | 評論 (0)編輯 收藏

            北大: http://acm.pku.edu.cn/JudgeOnline/
                浙大: http://acm.zju.edu.cn/
                同濟: http://acm.tongji.edu.cn/
                吉林大學: http://acm.jlu.edu.cn/joj/
                杭州電子科技: http://acm.hdu.edu.cn/
                天津大學: http://acm.tju.edu.cn/toj/
                哈工大: http://acm.hit.edu.cn/
                武漢大學: http://acm.whu.edu.cn/
                哈爾濱工程: http://acm.hrbeu.edu.cn/
                福建師范: http://acm.fjnu.edu.cn/
                中科大: http://acm.ustc.edu.cn
                廈門大學: http://acm.xmu.edu.cn/JudgeOnline/
                合肥工大: http://acm.tdzl.net/JudgeOnline/
                北大內部: http://ai.pku.cn/JudgeOnline
                華中科技: http://acm.hust.edu.cn/JudgeOnline
                寧波理工: http://acm.nit.net.cn
               浙江工業: http://acm.zjut.edu.cn
                南開大學: http://nkacm.cn
                VIJOS: http://www.vijos.cn
                MyOJ: http://tzoi.dynserv.com
                Ural State University: http://acm.timus.ru
                Saratov State University : http://acm.sgu.ru
                美國官方USACO: http://ace.delos.com/usacogate/
                安徽師范大學 : 不好意思, 過于強大, 僅供內部使用 

               這是本人個人整理的,如想復制,請隨便。

            posted @ 2010-08-17 13:51 Brian 閱讀(489) | 評論 (0)編輯 收藏

            求n的平方根,先假設一猜測值DE>X0 = 1DE>,然后根據以下公式求出DE>X1DE>,再將DE>X1DE>代入公式右邊,繼續求出DE>X2DE>…通過有效次迭代后即可求出n的平方根,DE>Xk+1DE>

            x_(k+1)=1/2(x_k+n/(x_k))

            先讓我們來驗證下這個巧妙的方法準確性,來算下2的平方根 (Computed by Mathomatic)

            1-> x_new = ( x_old + y/x_old )/2
            y
            (x_old + -----)
            x_old
            #1: x_new = ---------------
            2
            1-> calculate x_old 1
            Enter y: 2
            Enter initial x_old: 1
             x_new = 1.5
            1-> calculate x_old 2
            Enter y: 2
            Enter initial x_old: 1
             x_new = 1.4166666666667
            1-> calculate x_old 3
            Enter y: 2
            Enter initial x_old: 1
             x_new = 1.4142156862745
            1-> calculate x_old 10
            Enter y: 2
            Enter initial x_old: 1
            Convergence reached after 6 iterations.
             x_new = 1.4142135623731
            ...

            可見,隨著迭代次數的增加,運算值會愈發接近真實值。很神奇的算法,可是怎么來的呢? 查了下wikipediawolfram,原來算法的名字叫Newton’s Iteration (牛頓迭代法)。

            下面是數理介紹,不喜歡數學的言下之意也就是絕大部分人可以略過了。

            簡單推導

            假設DE>f(x)DE>是關于DE>XDE>的函數:

            An illustration of on<wbr>e iteration of Newton's method

            求出DE>f(x)DE>的一階導,即斜率:

            f'(x_{n}) = frac{ mathrm{rise} }{ mathrm{run} } = frac{ mathrm{Delta y} }{ mathrm{Delta x} } = frac{ f( x_{n} ) - 0 }{ x_{n} - x_{n+1} } = frac{0 - f(x_{n})}{(x_{n+1} - x_{n})},!

            簡化等式得到:

            x_(n+1)=x_n-(f(x_n))/(f^'(x_n))

            然后利用得到的最終式進行迭代運算直至求到一個比較精確的滿意值,為什么可以用迭代法呢?理由是中值定理(Intermediate Value Theorem):

            如果DE>fDE>函數在閉區間DE>[a,b]DE>內連續,必存在一點DE>xDE>使得DE>f(x) = cDE>,DE>cDE>是函數DE>fDE>在閉區間DE>[a,b]DE>內的一點

            我們先猜測一DE>XDE>初始值,例如1,當然地球人都知道除了1本身之外任何數的平方根都不會是1。然后代入初始值,通過迭代運算不斷推進,逐步靠近精確值,直到得到我們主觀認為比較滿意的值為止。例如要求768的平方根,因為DE>252 = 625DE>,而DE>302 = 900DE>,我們可先代入一猜測值26,然后迭代運算,得到較精確值:27.7128。

            回到我們最開始的那個”莫名其妙”的公式,我們要求的是DE>NDE>的平方根,令DE>x2 = nDE>,假設一關于DE>XDE>的函數DE>f(x)DE>為:

            DE>f(X) = X2 - nDE>

            DE>f(X)DE>的一階導為:

            DE>f'(X) = 2XDE>

            代入前面求到的最終式中:

            DE>Xk+1 = Xk - (Xk2 - n)/2XkDE>

            化簡即得到我們最初提到的那個求平方根的神奇公式了:

            x_(k+1)=1/2(x_k+n/(x_k))

            用泰勒公式推導

            我之前介紹過在The Art and Science of C一書中有用到泰勒公式求平方根的算法,其實牛頓迭代法也可以看作是泰勒公式(Taylor Series)的簡化,先回顧下泰勒公式:

            f(x_0+epsilon)=f(x_0)+f^'(x_0)epsilon+1/2f^('')(x_0)epsilon^2+....

            僅保留等式右邊前兩項:

            f(x_0+epsilon) approx f(x_0)+f^'(x_0)epsilon.

            DE>f(X0+ε) = 0DE>,得到:

            epsilon_0=-(f(x_0))/(f^'(x_0))

            再令DE>X1 = X0 + ε0DE>,得到DE>ε1DE>…依此類推可知:

            epsilon_n=-(f(x_n))/(f^'(x_n))

            轉化為:

            x_(n+1)=x_n-(f(x_n))/(f^'(x_n))

            posted @ 2010-08-17 13:49 Brian 閱讀(715) | 評論 (0)編輯 收藏

            好幾個人問我校內OJ的回文數那道題,我去年沒做,現在看了,怪不錯的一道題:

            Description

            若一個數(首位不為零)從左向右讀與從右向左讀都一樣,我們就將其稱之為回文數。例如121就是一個回文數。
            對于任意一個數,可以進行如下變換,可以得到一個回文數。
            例如:
            給定一個10進制數56,將56加65(即把56從右向左讀),得到121是一個回文數。
            又如:
            對于10進制數87:
            STEP1:87+78 = 165
            STEP2:165+561 = 726
            STEP3:726+627 = 1353
            STEP4:1353+3531 = 4884
            在這里的一步是指進行了一次N進制的加法,上例最少用了4步得到回文數4884。

            寫一個程序,給定一個N(2<=N<=10,N=16)進制數M,求最少經過幾步可以得到回文數。如果在30步以內(包含30步)不可能得到回文數,則輸出“Impossible!”

            Input

            第一行為N
            第二行為M

            Output

            STEP=步數

            Impossible!

            Sample Input

            9
            87

             

             

            Sample Output

            STEP=6
            #include<stdio.h>
            #include
            <string.h>
            char M[20];
            int N,len;// 進制、字符串長度
            int a[20]={0},b[20]={0};

            void Format(char a[],int b[])
            {
                
            int i=0;
                
            for (; i<len; i++)
                    
            if(N>10 && a[i]>='A')
                        b[i]
            =a[i]-'A'+10;
                    
            else b[i]=a[i]-'0';


            void Step()
            {
                
            int i=0;
                a[len]
            =0;
                
            for (; i<len; i++)
                    b[i]
            =a[len-i-1];
                
            for (i=0; i<len; i++//核心代碼
                {
                    a[i]
            +=b[i];
                    
            if (a[i]>N-1)
                    {
                        a[i
            +1]+=a[i]/N;
                        a[i]
            =a[i]%N;
                    }
                }
                
            if(a[len]) len++;       
            }

            int IsPalindrome() //判斷是否是回文數
            {
                
            int i=0;
                
            for (; i<=len/2; i++)
                    
            if (a[i]!=a[len-1-i])
                        
            return 0;
                
            return 1;


            int main()
            {
                
            int STEPS=0;
                scanf(
            "%d",&N);
                scanf(
            "%s",M);
                
                len
            =strlen(M);
                Format(M,a); 
            //將字符轉化為對應進制數字
                while(1)
                {
                    
            if(STEPS>30)
                    {
                        printf(
            "Impossible!\n");
                        
            return 0;
                    }
                    
            if(STEPS && IsPalindrome())
                        
            break;
                    Step();
                    STEPS
            ++;
                }
                
                printf(
            "STEP=%d\n",STEPS);
                
            return 0;
            }
            我的是任意進制都可以的, 192MS 0K

            posted @ 2010-08-17 13:48 Brian 閱讀(867) | 評論 (0)編輯 收藏

            約瑟夫環實在是太奇妙啦(我很高興我的這篇原創文章被不少人轉載了,雖然他們都沒有引用出處... ...)!
            1012 Joseph
            Description

            The Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mth is going to be executed and only the life of the last remaining person will be saved. Joseph was smart enough to choose the position of the last remaining person, thus saving his life to give us the message about the incident. For example when n = 6 and m = 5 then the people will be executed in the order 5, 4, 6, 2, 3 and 1 will be saved.

            Suppose that there are k good guys and k bad guys. In the circle the first k are good guys and the last k bad guys. You have to determine such minimal m that all the bad guys will be executed before the first good guy.

            Input

            The input file consists of separate lines containing k. The last line in the input file contains 0. You can suppose that 0 < k < 14.

            Output

            The output file will consist of separate lines containing m corresponding to k in the input file.
            2244 Eeny Meeny Moo

            Description

            Surely you have made the experience that when too many people use the Internet simultaneously, the net becomes very, very slow.
            To put an end to this problem, the University of Ulm has developed a contingency scheme for times of peak load to cut off net access for some cities of the country in a systematic, totally fair manner. Germany's cities were enumerated randomly from 1 to n. Freiburg was number 1, Ulm was number 2, Karlsruhe was number 3, and so on in a purely random order.
            Then a number m would be picked at random, and Internet access would first be cut off in city 1 (clearly the fairest starting point) and then in every mth city after that, wrapping around to 1 after n, and ignoring cities already cut off. For example, if n=17 and m=5, net access would be cut off to the cities in the order [1,6,11,16,5,12,2,9,17,10,4,15,14,3,8,13,7]. The problem is that it is clearly fairest to cut off Ulm last (after all, this is where the best programmers come from), so for a given n, the random number m needs to be carefully chosen so that city 2 is the last city selected.

            Your job is to write a program that will read in a number of cities n and then determine the smallest integer m that will ensure that Ulm can surf the net while the rest of the country is cut off.

            Input

            The input will contain one or more lines, each line containing one integer n with 3 <= n < 150, representing the number of cities in the country.
            Input is terminated by a value of zero (0) for n.

            Output

            For each line of the input, print one line containing the integer m fulfilling the requirement specified above.
             
            1012打表做法 C :
            #include<stdio.h>
            int a[14]={2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881,13482720};
            int main()
            {
             int i;
             while ( scanf("%d",&i), i != 0 )
              printf("%d\n",a[i-1]);
             return 0;
            } // 這是從網上找的做法,號稱打表法,這些數據依舊要通過建立循環鏈表或是別的模擬法來求出。但是單純為了AC,這種做法真的是相當有效,講白了就是有目的的窮舉結果。
            1012模擬法 C: 可惜呀可惜!這個總是 超時!我不知道是什么原因。但是思路是正確的,可能有些地方我沒有考慮到,看到這篇日志的人請指點。
            #include<stdio.h>
            int main()
            {
             int i,m,k,cur,rest;
             
             while(1)
             {
              i=0; // the use ... sort of m in the question
              m=0;
              scanf("%d",&k);
              if (k == 0) break;
              while (1)
              {
               i++;
               rest=2*k; // good + bad guys
               cur=0;
               while (1)
               {
                cur=(cur+i-1)%rest; // find next from ZERO!
                if (cur >= k)
                 rest--;
                else break;
               }
               if (rest == k)
               {
                m=i;
                break;
               }
              }
              printf("%d\n",m);
             }
             return 0;
            }
            對于 2244,建議看一個牛人的ACM博客: www.shnenglu.com/AClayton/archive/2007/11/06/35964.html
            我就是看這篇博文的,很牛的一個人 AClayton ,寫的日期剛好是我生日,下面是其全部博文:
            --------------------------------------------------------------------------------------------------------------------------------------------

             在沒有明白約瑟夫問題之前,只能用模擬來做.
                  約瑟夫問題是這樣的:
                  假設n個人,編號為1到n,排成一個圈,順時針從1開始數字m,數到m的人殺了,剩下的人繼續游戲.活到最后的一個人是勝利者.一般來說需要編程求解最后一個人的編號.
                  思路是這樣的:
                 假設當前剩下i個人(i<=n),顯然這一輪m要掛(因為總是從1開始數).經過這一輪,剩下的人是:1 2 3 ... m- 1 m + 1 ... i, 我們將從m+1開始的數映射成1, 則m+2對應2, n對應i - m, 1對應成i - m + 1  m - 1對應i - 1,那么現在的問題變成了已知i - 1個人進行循環報數m,求出去的人的序號。假設已經求出了i- 1個人循環報數下最后一個出去的人的序號X0,那么它在n個人中的序號X1=(X0+ m - 1) % n + 1,  最初的X0=1 ,反復迭代X0和X1可以求出.
                 簡單約瑟夫問題的解法:
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse#include <stdio.h >
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehousemain()
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian WarehousePOJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse{
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            int n, m,i, s=0
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    printf( 
            "N  M  =  "); scanf("%d%d ",&n,&
            m);
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            for(i=2;i<=n;i++)s=(s+m)%
            i;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    printf(
            "The winner is %d\n ", s+1
            );
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse}
              

                  這倒題其實不是完全的約瑟夫問題,而是稍微變了形.呵呵,聰明的讀者自己發現!這一點費了我很久的時間,還害我逃了課被點名...
                這道題的我解法是這樣的.

            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse#include   <stdio.h >
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            int y(int n,int m)
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian WarehousePOJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            {
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            int s=1
            ,i;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            for(i=2;i<=n-1;i++
            )
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse        s
            =(s+m-1)%i+1
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            return s+1
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse}

            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehousemain()
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian WarehousePOJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse{
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            int
             m,n;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            while(1
            )
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian WarehousePOJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            {
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    scanf(
            "%d",&
            n);
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            if(n==0)break
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse     
            for(m=1
            ;;)
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian WarehousePOJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse     
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            {
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse         
            if(y(n,m)==2)break
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse         m
            ++
            ;
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse     }

            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse   
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    printf(
            "%d\n",m);
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    
            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse    }

            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse}

            POJ 1012 2244 Joseph 問題詳解 - Icho - Brian Warehouse

                   讀一個數處理一個數, Memory 68K,時間31MS,如果覺得效率不高. 優化的辦法是打表~

            -----------------------------------------------------------------------------------------------------------------------------
            由此可見,將問題化歸為數學問題,用初等高等或是數論來解決的能力是多么重要。
            下面是我根據AClayton的思路簡化后的代碼,可直接AC: 注意,題目讓你先讓City 1 掛掉
            2244  編譯器 C :
            #include<stdio.h>
            void main()
            {
             
            int i,r,m,n;
             
            while (scanf("%d",&n) && n)
             {
                
            for (m=1; ; m++)
                {
                 
            for (r=1,i=2; i<=n-1; i++)
                  r
            =(r+m-1)%+ 1;
                 
            if(r==1break;
                }
                printf(
            "%d\n",m);
             }
            // 164K  16MS
             

            posted @ 2010-08-17 13:42 Brian 閱讀(2088) | 評論 (3)編輯 收藏

            DS理論也被認為是信度函數理論,是主觀概率(subjective probability)的貝葉斯理論的擴展。信度函數允許我們基于信度使用一個問題的概率來推導一個相關問題的概率。這些信度值可能有也可能沒有概率的數學性質;他們與概率的差異大小將取決于這兩個問題有多相關。

                   History..

                   DS理論基于兩個思想:1. the idea of obtaining degrees of belief for one question from subjective probabilities for a related question 獲取一個問題對于另一個問題的信度值。2. Dempster's rule for combining such degrees of belief when they are based on independent items of evidence 當這些信度值都基于獨立的證據時,把他們結合起來的D規則。

                   為了描述第一個思想,考慮我知道我的朋友Betty是否可靠的主觀概率。我認為她可靠的概率是0.9,不可靠的概率是0.1。假設她告訴我一個樹枝掉在了我的車上。當她可靠的時候,這個論斷一定是真的,當她不可靠的時候這個論斷卻不一定是假的。所以當僅有她的證詞的時候justifies0.9的信度有一個樹枝掉在了我的車上了,但僅僅有0的信度值保證沒有樹枝掉在我的車上。這個零并不意味著我可以肯定沒有樹枝掉在我的車上,而概率零可以保證;它僅僅表示了Betty的證詞沒有給我任何理由相信沒有樹枝掉在我的車上。這個0.9和0在一起構成了一個信度函數(belief function)。

                   假設,從另外一個方面,Betty和Sally互相矛盾——Betty說一個樹枝掉在了我的車上,Sally說沒有樹枝掉在了我的車上。在這種情況下,他們不能都對,因為不可能兩個人都是可靠的——只有可能有一個人是可靠的或者都不可靠。三種情況,只有Betty可靠,只有Sally可靠,或都不可靠,概率分別為0.09,0.09,0.01,給定不是都可靠的情況下,后驗概率是9/19,9/19,1/19。( 0.09/(0.09+0.09+0.01) )所以我們有9/19的信度對于有一個樹枝掉在了我的車上(Betty可靠)以及9/19的信度對于沒有樹枝掉在了我的車上(Sally可靠)。

                   總的來說,我們要從另一個問題(證人是否可靠)的概率獲取一個問題的信度(是否有樹枝掉在了我的車上?)。Dempster規則首先有一個假設我們知道概率的問題都是獨立的對于我們主觀的概率判斷,但這個獨立性僅僅是一個priori;當在證據的不同部分發現沖突的時候就不在需要了(?)。

                   在一個具體問題中實現DS理論大致包括兩個相關的問題。首先,我們必須把問題的不確定性分成證據的先驗獨立的部分。然后我們再運行Dempster規則。這兩個問題和他們的解決方法都是非常相關的。把不確定性s分成獨立的部分產生包含了證據(其中有不同但相關的問題)不同部分的結構,使用這個結構可以讓計算可行。例如,假設Betty和Sally相互獨立的作證他們聽到了有賊到我的房間。他們可能都會把一只狗的噪聲誤以為成是一個賊,由于這種公共的不確定性,我不能直接使用D規則來把他們的信度結合起來。但是如果我知道到狗存在的可能性,然后我能確定證據的三個獨立部分:我另一個支持或反對狗存在的證據,我對Betty可靠的證據,以及我對Sally可靠的證據。我能通過D規則把證據的三個部分結合起來,在包含了這些不同問題的結構被考慮的時候,計算就可以施行了。

            posted @ 2010-08-17 13:38 Brian 閱讀(360) | 評論 (0)編輯 收藏

            這是個初學JAVA必要頭疼的問題。集合我找來的資料和親身實踐,我的這種方法應該是萬無一失的了。我用的是JDK 1.7.0。

            第一步 右擊我的電腦,點擊屬性

            第二步:選擇高級選項卡,點擊環境變量

            第三步:在下方的系統變量中,設置3項屬性,JAVA_HOME, PATH, CLASSPATH(大小寫無所謂),若已存在則點擊編輯,不存在則點擊新建  

            第四步JAVA_HOME設為JDK的安裝路徑(D:\program files\Java\jdk1.7.0),此路徑下包括libbinjre等文件夾(此變量最好設置,因為以后運行tomcateclipse等都需要依靠此變量);

            Path使得系統可以在任何路徑下識別java命令,設為:

            %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin (可直接復制過去,如果添加在末尾,需在最前面加個 ; )

            CLASSPATHjava加載類(class or lib)路徑,只有類在classpath中,java命令才能識別,設為:

            .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar  (注意最前面有個 .  表示當前路徑,可直接復制)

            %JAVA_HOME%就是引用前面指定的JAVA_HOME

             第五步開始”->“運行鍵入“cmd ”后打開了命令提示符窗口:

             編寫一個簡單的java實例來測試一下

            記事本中輸入以下代碼:

            public class Hello
            {
             public static void main(String[ ] args)
              {
                System.out.println("Hello World");
              }
            }

             

            把文件另存為D:\,再重命名為“Hello.java” 在命令提示符下

            輸入cd D:\回車;

            再輸入“D:\ ”  回車;

            再輸入“javac Hello.java”回車;

            如果命令提示窗口沒有任何反映那么表示編譯成功,javac會在D盤下生成一個Hello.class的文件,叫類文件

            然后執行這個類文件 在命令提示符下

            輸入“java Hello” 回車;

            出現 “Hello World” ,就說明全部都成功了。

            posted @ 2010-08-17 13:28 Brian 閱讀(687) | 評論 (0)編輯 收藏

            For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.

            Input

            Input contains integer number N (1<=N<=106)
            首先想到的是枚舉,我確實也這么做了,5~8無果,對于9,我的05年方正 Pentium M  上跑了足足1分半鐘之久,我一開始還以為死循環了,后來出來八個結果,也去網上核對了一下,確實滿足的只有這八個:
               111111111
               119357639
               380642361
               388888889
               611111111
               619357639
               880642361
               888888889
            我沒有學過數論,找到一篇博文,對于數論解法講的還算清楚,不過用pascal寫就,我自己用C寫了一下,第三次AC了。博文鏈接如下:http://blog.csdn.net/Skyprophet/archive/2009/10/05/4634801.aspx

            #include <stdio.h>
            int main()
            {
                
            int N,i=0;
                scanf(
            "%d",&N);
                
            if (N<=8)
                    printf(
            "0\n");
                
            else if (N==9)
                    printf(
            "8\n");
                
            else
                {
                    printf(
            "72");
                    
            for (; i<N-10; i++)
                        printf(
            "0");
                    printf(
            "\n");
                }
                
            return 0;
            }
            336MS  0K

            posted @ 2010-08-17 13:27 Brian 閱讀(308) | 評論 (0)編輯 收藏

            There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3. (找出這個數列1-N號元素中能被3整除的有多少個)

            Input

            Input contains N (1<=N<=231 - 1).

            一個數乘以10以后,模3后結果不變,第2,5,8,11,14,17........項滿足要求

            #include <stdio.h>
            int main()
            {
                
            int N;
                scanf(
            "%d",&N);
                N
            --;
                printf(
            "%d\n", N-(N/3));
                
            return 0;
            }  
            // 0K  0MS

            posted @ 2010-08-17 13:26 Brian 閱讀(278) | 評論 (0)編輯 收藏

            題目簡單翻譯:對于給出的整數 N (1<=N<=104) ,找出所有不大于N且與N互質的正整數個數
            兩個正整數A和B互質的意思是它們的最大公約數是1。現看一下百度百科上關于質數的定義吧。
            當我采用直接數的辦法AC后,我發現跟質數完全沒有關系。
            #include<stdio.h>

            int gcd(int m,int n) // greatest common divisor
            {
                
            int r=m%n;
                
            while(r)         // 輾轉相除法,TAOCP的第一個算法
                {
                    m
            =n;
                    n
            =r;
                    r
            =m%n;
                }
                
            return n;
            }

            int main()
            {
                
            int N,c=0,i=1// must start with 1 !
                scanf("%d",&N);
                
            for (; i<=N; i++)
                    
            if (gcd(N,i)==1// question hint
                        c++;
                printf(
            "%d",c);
                
            return 0;
            }
            //  102  .C Accepted 0 ms 0 kb 

            posted @ 2010-08-17 13:24 Brian 閱讀(200) | 評論 (0)編輯 收藏

            僅列出標題
            共4頁: 1 2 3 4 
            51久久夜色精品国产| 久久国产亚洲精品无码| 久久播电影网| 一本一本久久a久久综合精品蜜桃| 亚洲愉拍99热成人精品热久久| 久久99精品久久久久婷婷| 91久久香蕉国产熟女线看| 伊人久久大香线蕉综合5g| 精品熟女少妇a∨免费久久| 久久伊人影视| 国产成年无码久久久久毛片| 久久久精品久久久久久 | 一本一本久久a久久综合精品蜜桃| 久久ww精品w免费人成| 久久亚洲高清综合| 97久久精品人妻人人搡人人玩| 久久99精品久久久久久秒播| 无码国内精品久久人妻| 精品久久人人妻人人做精品| 久久精品欧美日韩精品| 婷婷久久综合| 国产精品美女久久久网AV| 国产精品久久久久国产A级| 久久综合亚洲鲁鲁五月天| 狠狠色综合久久久久尤物| 久久精品国产91久久麻豆自制| 囯产极品美女高潮无套久久久 | 99久久婷婷国产一区二区| 人妻无码αv中文字幕久久琪琪布| 日韩久久久久中文字幕人妻| 品成人欧美大片久久国产欧美...| 无码精品久久久天天影视 | 久久中文字幕无码专区| 国产精品亚洲综合专区片高清久久久| 久久久久久久人妻无码中文字幕爆| 国产精品久久久香蕉| 久久免费视频1| 色综合久久无码五十路人妻| 亚洲国产精品无码久久久蜜芽| 亚洲色大成网站www久久九| 少妇精品久久久一区二区三区|