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

            coreBugZJ

            此 blog 已棄。

            SPOJ 1112. Number Steps

            1112. Number Steps

            Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued.

             

            Illustration



            You are to write a program that reads the coordinates of a point (x, y), and writes the number (if any) that has been written at that point. (x, y) coordinates in the input are in the range 0...10000.

             

            Input

            The first line of the input is N, the number of test cases for this problem. In each of the N following lines, there is x, and y representing the coordinates (x, y) of a point.

             

            Output

            For each point in the input, write the number written at that point or write No Number if there is none.

             

            Example

            Input:
            3
            4 2
            6 6
            3 4
            Output:
            6
            12
            No Number
            
             
             
            我的代碼:
            ; spoj  1112
            section .data
                    noans : db 'No Number', 0x0a
                    noansL : equ $ - noans
            section .text
                    global _start
            _start : 
                    push ebp
                    mov ebp, esp
                    sub esp, 12
                    mov eax, ebp
                    sub eax, 4
                    push eax
                    call inInt
                L5 : 
                    mov eax, [ebp-4]
                    test eax, eax
                    jz L6_A
                    dec eax
                    mov [ebp-4], eax
                    mov eax, ebp
                    sub eax, 8
                    push eax
                    call inInt
                    mov ebx, [ebp-8]
                    mov eax, ebp
                    sub eax, 12
                    push eax
                    call inInt
                    mov ecx, [ebp-12]
                    cmp ebx, 0
                    je X0
                    cmp ebx, 1
                    je X1
                    cmp ebx, ecx
                    je XY_A
                    add ecx, 2
                    cmp ebx, ecx
                    je XY2
                    ;jmp NO
                NO :
                    mov eax, 4
                    mov ebx, 1
                    mov ecx, noans
                    mov edx, noansL
                    int 0x80
                    jmp L5
                L6_A :
                    jmp L6_B
                X0 :
                    cmp ecx, 0
                    jne NO
                    ;jmp X0Y0
                X0Y0 :
                    push dword 0
                    call outInt
                    call outLn
                    jmp L5
                XY_A :
                    jmp XY
                X1 :
                    cmp ecx, 1
                    jne NO
                    ;jmp X1Y1
                X1Y1 :
                    push dword 1
                    call outInt
                    call outLn
                    jmp L5
                L6_B :
                    jmp L6
                XY2 :
                    mov eax, ebx
                    and eax, 0x1
                    jnz XoYo2
                    ;jmp XeYe2
                XeYe2 :
                    shl ebx, 1
                    sub ebx, 2
                    push ebx
                    call outInt
                    call outLn
                    jmp L5
                XoYo2 :
                    shl ebx, 1
                    sub ebx, 3
                    push ebx
                    call outInt
                    call outLn
                    jmp L5
                XY :
                    mov eax, ebx
                    and eax, 0x1
                    jnz XoYo
                    ;jmp XeYe
                XeYe :
                    shl ebx, 1
                    push ebx
                    call outInt
                    call outLn
                    jmp L5
                XoYo :
                    shl ebx, 1
                    dec ebx
                    push ebx
                    call outInt
                    call outLn
                    jmp L5
                L6 : 
                    push 0
                    call exit
                    mov esp, ebp
                    pop ebp
                    ret
            ; func void exit( int )
            exit :
                    mov eax, 1
                    mov ebx, [esp+4]
                    int 0x80
                    ret 4
            ; func void inInt( uint * )
            inInt :
                    push ebp
                    mov ebp, esp
                    sub esp, 8
                    push eax
                    push ebx
                    push ecx
                    push edx
                    mov eax, [ebp+8]
                    mov dword [eax], 0
                    mov dword [ebp-8], 0
                L4 :
                    mov eax, 3
                    mov ebx, 0
                    mov ecx, ebp
                    sub ecx, 4
                    mov edx, 1
                    int 0x80
                    xor ebx, ebx
                    mov bl, byte[ecx]
                    cmp ebx, 0x30
                    jb L3
                    cmp ebx, 0x39
                    ja L3
                    sub ebx, 0x30
                    mov ecx, [ebp+8]
                    mov eax, [ecx]
                    xor edx, edx
                    mov ecx, 10
                    mul ecx
                    add eax, ebx
                    mov ecx, [ebp+8]
                    mov [ecx], eax
                    mov dword [ebp-8], 1
                    jmp L4
               L3 :
                    mov eax, [ebp-8]
                    test eax, eax
                    jz L4
               L2 :
                    pop edx
                    pop ecx
                    pop ebx
                    pop eax
                    mov esp, ebp
                    pop ebp
                    ret 4
            ; func void outInt( uint )
            outInt :
                    push ebp
                    mov ebp, esp
                    sub esp, 64
                    push edx
                    push eax
                    push ecx
                    mov eax, [ebp+8]
                    xor ebx, ebx
                L1 :
                    xor edx, edx
                    mov ecx, 10
                    div ecx
                    inc ebx
                    add dl, 0x30
                    mov ecx, ebp
                    sub ecx, ebx
                    mov byte[ecx], dl
                    test eax, eax
                    jnz L1
                    mov edx, ebx
                    mov eax, 4
                    mov ebx, 1
                    mov ecx, ebp
                    sub ecx, edx
                    int 0x80
                    pop ecx
                    pop eax
                    pop edx
                    mov esp, ebp
                    pop ebp
                    ret 4
            ; func void outLn()
            outLn :
                    push ebp
                    mov ebp, esp
                    sub esp, 4
                    push eax
                    mov eax, 4
                    push ebx
                    mov ebx, 1
                    push ecx
                    mov ecx, ebp
                    sub ecx, 4
                    mov byte[ecx], 0x0a
                    push edx
                    mov edx, 1
                    int 0x80
                    pop edx
                    pop ecx
                    pop ebx
                    pop eax
                    mov esp, ebp
                    pop ebp
                    ret

             

            posted on 2011-03-16 13:44 coreBugZJ 閱讀(1122) 評論(0)  編輯 收藏 引用 所屬分類: Assemble

            久久精品这里只有精99品| 99久久免费国产精品特黄| 精品人妻伦九区久久AAA片69 | 成人亚洲欧美久久久久| 狠狠综合久久综合中文88| 中文字幕亚洲综合久久菠萝蜜| 国产毛片欧美毛片久久久| 99国产精品久久久久久久成人热| 久久精品国产精品亚洲艾草网美妙| 一级a性色生活片久久无| 久久久久久毛片免费播放| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久人人爽人人爽人人片AV麻豆 | 欧美亚洲国产精品久久高清| 97久久超碰国产精品2021| 亚洲国产成人久久一区WWW| 77777亚洲午夜久久多喷| 久久精品视频一| 国产成人综合久久久久久| 老色鬼久久亚洲AV综合| 久久精品成人一区二区三区| 国产亚洲色婷婷久久99精品| 久久国产劲爆AV内射—百度| 久久国产乱子伦精品免费午夜| 91精品国产乱码久久久久久 | 久久这里有精品视频| 四虎国产精品免费久久久| 久久天天躁狠狠躁夜夜网站| 国产精品乱码久久久久久软件| 97久久精品人人做人人爽| 国产精品免费福利久久| 伊人久久大香线蕉综合Av| 亚洲综合久久久| 欧美亚洲国产精品久久久久| 精品久久久久久99人妻| 亚洲国产成人久久精品影视| 久久精品国产一区| 精品久久久久久国产三级| 国产成人精品综合久久久| 精品人妻伦九区久久AAA片69| 日本精品久久久久中文字幕|