• <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>

            oyjpArt ACM/ICPC算法程序設(shè)計(jì)空間

            // I am new in programming, welcome to my blog
            I am oyjpart(alpc12, 四城)
            posts - 224, comments - 694, trackbacks - 0, articles - 6

            PKU1568 Find the Winning Move

            Posted on 2007-03-02 17:50 oyjpart 閱讀(1613) 評(píng)論(2)  編輯 收藏 引用 所屬分類: ACM/ICPC或其他比賽

            Find the Winning Move
            Time Limit:3000MS  Memory Limit:32768K
            Total Submit:120 Accepted:67

            Description
            4x4 tic-tac-toe is played on a board with four rows (numbered 0 to 3 from top to bottom) and four columns (numbered 0 to 3 from left to right). There are two players, x and o, who move alternately with x always going first. The game is won by the first player to get four of his or her pieces on the same row, column, or diagonal. If the board is full and neither player has won then the game is a draw.
            Assuming that it is x's turn to move, x is said to have a forced win if x can make a move such that no matter what moves o makes for the rest of the game, x can win. This does not necessarily mean that x will win on the very next move, although that is a possibility. It means that x has a winning strategy that will guarantee an eventual victory regardless of what o does.

            Your job is to write a program that, given a partially-completed game with x to move next, will determine whether x has a forced win. You can assume that each player has made at least two moves, that the game has not already been won by either player, and that the board is not full.

            Input
            The input contains one or more test cases, followed by a line beginning with a dollar sign that signals the end of the file. Each test case begins with a line containing a question mark and is followed by four lines representing the board; formatting is exactly as shown in the example. The characters used in a board description are the period (representing an empty space), lowercase x, and lowercase o. For each test case, output a line containing the (row, column) position of the first forced win for x, or '#####' if there is no forced win. Format the output exactly as shown in the example.

            Output
            For this problem, the first forced win is determined by board position, not the number of moves required for victory. Search for a forced win by examining positions (0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), ..., (3, 2), (3, 3), in that order, and output the first forced win you find. In the second test case below, note that x could win immediately by playing at (0, 3) or (2, 0), but playing at (0, 1) will still ensure victory (although it unnecessarily delays it), and position (0, 1) comes first.

            Sample Input

            ?
            ....
            .xo.
            .ox.
            ....
            ?
            o...
            .ox.
            .xxx
            xooo
            $

             

             

             

            Sample Output

            #####
            (0,1)
            

             

             

             

            Source
            Mid-Central USA 1999

            這個(gè)博弈 我用了Alpha-Beta剪枝 搜索是標(biāo)準(zhǔn)的極大極小的搜索過(guò)程
            hash用的是4進(jìn)制的便于位運(yùn)算的hash

             

            Feedback

            # re: PKU1568 Find the Winning Move   回復(fù)  更多評(píng)論   

            2007-03-11 19:08 by nick
            const int MAX = (1<<24)+1;

            MAX 不是應(yīng)該是 (1<<28)

            因?yàn)榭鄣粢婚_(kāi)始盤面上一定有兩個(gè)子以上 4*4-2 = 14
            然後 2*14 = 28

            為什麼是 1<<24 呢?

            # re: PKU1568 Find the Winning Move   回復(fù)  更多評(píng)論   

            2007-03-11 19:40 by oyjpart
            [quote] "You can assume that each player has made at least two moves, ..."
            which means that there must be 4 moves at the beginning :)
            精品一区二区久久| 亚洲精品美女久久久久99小说| 精品久久久噜噜噜久久久| 久久精品国产亚洲综合色| 久久久久国产一区二区| 久久久久亚洲AV成人片| 欧美与黑人午夜性猛交久久久| 伊人久久大香线蕉综合影院首页 | 久久人妻少妇嫩草AV蜜桃| 精品久久久无码人妻中文字幕豆芽 | 国产精品一久久香蕉国产线看观看 | 天天爽天天狠久久久综合麻豆| 亚洲综合精品香蕉久久网97| 精品久久久一二三区| 久久亚洲国产欧洲精品一| 亚洲午夜久久久影院| 欧美午夜精品久久久久久浪潮| 久久国产乱子伦精品免费强| 欧美午夜精品久久久久免费视| 女同久久| 久久久久亚洲AV成人网人人软件| 狠狠色丁香婷婷综合久久来| 久久丫精品国产亚洲av不卡 | 久久久九九有精品国产| 久久精品人人做人人爽97| 久久精品无码一区二区WWW| 亚洲精品无码久久毛片| 久久久久久青草大香综合精品| 亚洲国产天堂久久综合网站| 99久久精品国内| 国产精品久久久久久搜索| jizzjizz国产精品久久| 91视频国产91久久久| 久久国产精品一国产精品金尊| 人妻精品久久久久中文字幕一冢本| 久久精品综合网| 亚洲女久久久噜噜噜熟女| 亚洲AV日韩精品久久久久久 | 人妻无码αv中文字幕久久琪琪布| 色偷偷91久久综合噜噜噜噜| 久久午夜免费视频|