青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

coreBugZJ

此 blog 已棄。

Adding Reversed Numbers,spoj 42

42. Adding Reversed Numbers

Problem code: ADDREV

The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advisor of ACM has decided to transfigure some tragedies into comedies. Obviously, this work is very hard because the basic sense of the play must be kept intact, although all the things change to their opposites. For example the numbers: if any number appears in the tragedy, it must be converted to its reversed form before being accepted into the comedy play.

Reversed number is a number written in arabic numerals but the order of digits is reversed. The first digit becomes last and vice versa. For example, if the main hero had 1245 strawberries in the tragedy, he has 5421 of them now. Note that all the leading zeros are omitted. That means if the number ends with a zero, the zero is lost by reversing (e.g. 1200 gives 21). Also note that the reversed number never has any trailing zeros.

ACM needs to calculate with reversed numbers. Your task is to add two reversed numbers and output their reversed sum. Of course, the result is not unique because any particular number is a reversed form of several numbers (e.g. 21 could be 12, 120 or 1200 before reversing). Thus we must assume that no zeros were lost by reversing (e.g. assume that the original number was 12).

Input

The input consists of N cases (equal to about 10000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the reversed numbers you are to add.

Output

For each case, print exactly one line containing only one integer - the reversed sum of two reversed numbers. Omit any leading zeros in the output.

Example

Sample input: 

3
24 1
4358 754
305 794

Sample output:

34
1998
1


一段時間沒寫匯編了,使用輸入緩沖提高效率。。。


  1 ; spoj42.s
  2 
  3 %define  L  1024
  4 
  5 section .bss
  6         pBuf  : resb  L
  7         pBufN : resd 1
  8         pBufI : resd 1
  9 
 10 section .text
 11         global _start
 12 
 13 _start : 
 14         mov dword[pBufN], 0x0
 15         mov dword[pBufI], 0x0
 16         call inInt
 17 CASE : 
 18         test eax, eax
 19         jz EXIT
 20         dec eax
 21         push eax
 22 
 23         call inIntR
 24         push eax
 25         call inIntR
 26         pop ebx
 27         add eax, ebx
 28         call outIntLnR
 29 
 30         pop eax
 31         jmp CASE
 32 EXIT : 
 33         mov eax, 0x1
 34         mov ebx, 0x0
 35         int 0x80
 36 
 37 in eax
 38 inChar : 
 39         mov eax, [pBufI]
 40         mov ebx, [pBufN]
 41         cmp eax, ebx
 42         jne NOEMPTY
 43         mov eax, 0x3
 44         mov ebx, 0
 45         mov ecx, pBuf
 46         mov edx, L
 47         int 0x80
 48         mov [pBufN], eax
 49         mov dword[pBufI], 0
 50         xor eax, eax
 51 NOEMPTY : 
 52         mov ebx, eax
 53         inc ebx
 54         mov [pBufI], ebx
 55         add eax, pBuf
 56         mov bl, byte[eax]
 57         xor eax, eax
 58         mov al, bl
 59         ret
 60 
 61 in eax
 62 inInt : 
 63         xor eax, eax
 64         push eax
 65 SKIPSPACE : 
 66         call inChar
 67         cmp al, '0'
 68         jb SKIPSPACE
 69         cmp al, '9'
 70         ja SKIPSPACE
 71 INDIGIT : 
 72         mov ebx, eax
 73         pop eax
 74         mov ecx, 0xA
 75         xor edx, edx
 76         mul ecx
 77         sub ebx, '0'
 78         add eax, ebx
 79         push eax
 80 
 81         call inChar
 82         cmp al, '0'
 83         jb INDIGITEND
 84         cmp al, '9'
 85         ja INDIGITEND
 86         jmp INDIGIT
 87 INDIGITEND : 
 88         pop eax
 89         ret
 90 
 91 in eax
 92 inIntR : 
 93         xor eax, eax
 94         push eax
 95         mov eax, 0x1
 96         push eax
 97 SKIPSPACER : 
 98         call inChar
 99         cmp al, '0'
100         jb SKIPSPACER
101         cmp al, '9'
102         ja SKIPSPACER
103 INDIGITR : 
104         sub eax, '0'
105         pop ebx
106         xor edx, edx
107         mul ebx
108         pop ecx
109         add eax, ecx
110         push eax
111         mov eax, ebx
112         mov ecx, 0xA
113         xor edx, edx
114         mul ecx
115         push eax
116         
117         call inChar
118         cmp al, '0'
119         jb inIntRend
120         cmp al, '9'
121         ja inIntRend
122         jmp INDIGITR
123 inIntRend : 
124         pop eax
125         pop eax
126         ret
127 
128 out eax
129 outIntLnR : 
130         push ebp
131         mov ebp, esp
132         sub esp, 100
133         mov ebx, esp
134 ZEROBEG : 
135         test eax, eax
136         jz ZEROEND
137         mov ecx, 0xA
138         xor edx, edx
139         div ecx
140         add edx, '0'
141         mov byte[ebx], dl
142         inc ebx
143         jmp ZEROBEG
144 ZEROEND : 
145         mov eax, esp
146 ZEROSKIP : 
147         mov cl, byte[eax]
148         cmp cl, '0'
149         jnz ZEROSKIPEND
150         inc eax
151         jmp ZEROSKIP
152 ZEROSKIPEND : 
153         mov byte[ebx], 0xA
154         inc ebx
155         mov edx, ebx
156         sub edx, eax
157         mov ecx, eax
158         mov eax, 0x4
159         mov ebx, 0x1
160         int 0x80
161 
162         mov esp, ebp
163         pop ebp
164         ret
165 

posted on 2011-05-18 15:27 coreBugZJ 閱讀(740) 評論(0)  編輯 收藏 引用 所屬分類: Assemble

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久国产精彩视频| 一本一本久久a久久精品综合妖精| 亚洲欧美中文另类| 亚洲一区二区四区| 国产欧美日本| 久久亚洲综合网| 免费成年人欧美视频| av72成人在线| 亚洲影音先锋| 在线观看日韩欧美| 亚洲精品日韩综合观看成人91| 欧美日韩综合久久| 久久久久久九九九九| 老牛国产精品一区的观看方式| 亚洲美女淫视频| 亚洲女同性videos| 91久久久亚洲精品| 亚洲在线1234| 亚洲国产mv| 亚洲一区二区三区精品视频| 狠狠色丁香久久婷婷综合_中| 亚洲福利av| 国产精品精品视频| 女女同性精品视频| 国产精品裸体一区二区三区| 久久综合给合久久狠狠色 | 久久狠狠久久综合桃花| 久久亚洲免费| 欧美在线播放一区| 欧美激情一二三区| 久久手机免费观看| 国产精品白丝黑袜喷水久久久| 蜜臀av国产精品久久久久| 欧美色图麻豆| 亚洲第一中文字幕在线观看| 国产美女诱惑一区二区| 亚洲精品中文字幕女同| 在线欧美日韩| 午夜精品视频网站| 亚洲——在线| 欧美激情综合亚洲一二区| 久久综合九色欧美综合狠狠| 国产精品久久久久久久7电影| 美脚丝袜一区二区三区在线观看| 国产精品一区在线观看| 日韩视频在线一区二区三区| 91久久嫩草影院一区二区| 久久久国产午夜精品| 欧美在线二区| 国产精品视频成人| 在线亚洲精品福利网址导航| 99国产精品| 欧美电影打屁股sp| 欧美成人精品激情在线观看| 狠狠入ady亚洲精品经典电影| 午夜精品福利视频| 欧美与黑人午夜性猛交久久久| 欧美午夜一区二区三区免费大片 | 亚洲欧美电影在线观看| 亚洲无人区一区| 欧美日韩一区二区高清| 亚洲国产女人aaa毛片在线| 亚洲国产午夜| 欧美国产日韩在线| 亚洲片在线资源| 一区二区动漫| 欧美四级在线| 亚洲午夜羞羞片| 欧美一二三视频| 国产一区成人| 久久精品一本久久99精品| 久久综合狠狠综合久久综合88| 国产综合色产| 免费在线欧美黄色| 亚洲三级毛片| 亚洲一区www| 国产日韩欧美精品| 久久久精品国产免大香伊| 欧美va亚洲va日韩∨a综合色| 亚洲国产精品一区二区www在线| 欧美成人高清视频| 一区二区三区四区五区在线| 久久国产乱子精品免费女| 国产在线拍偷自揄拍精品| 毛片一区二区三区| 99re这里只有精品6| 欧美亚洲日本网站| 亚洲福利视频网站| 欧美午夜一区二区| 久久久999精品| 亚洲精品国产精品国自产在线 | 亚洲精品视频在线播放| 欧美午夜电影在线| 久久精品国产免费观看| 亚洲激情第一页| 欧美一区二区私人影院日本| 在线成人av.com| 国产精品白丝av嫩草影院 | 亚洲免费在线视频一区 二区| 美国十次成人| 性娇小13――14欧美| 亚洲高清三级视频| 国产精品视频免费观看| 欧美 日韩 国产一区二区在线视频| 日韩亚洲国产欧美| 欧美.com| 久久精品官网| 亚洲一区二区精品在线| 亚洲国产精品国自产拍av秋霞 | 欧美不卡在线| 午夜在线不卡| 一本色道久久综合亚洲91| 麻豆精品一区二区综合av| 午夜久久影院| 在线综合亚洲欧美在线视频| 在线观看亚洲a| 国产午夜精品视频免费不卡69堂| 欧美激情在线免费观看| 久久久久综合| 欧美一区二区三区精品| 中日韩在线视频| 亚洲日韩成人| 亚洲电影在线观看| 男同欧美伦乱| 老色批av在线精品| 久久精品国产一区二区三| 亚洲欧美成人一区二区在线电影 | 亚洲成色www久久网站| 国产亚洲精品一区二555| 国产精品久久久久久久久久久久久久 | 欧美在线3区| 欧美夜福利tv在线| 午夜在线观看免费一区| 亚洲一区二区免费看| 亚洲最新视频在线| 一区二区日本视频| 在线视频一区观看| 亚洲私人黄色宅男| 亚洲综合第一页| 亚洲欧美精品一区| 先锋资源久久| 欧美在线网站| 久久亚洲私人国产精品va| 久久久999精品视频| 久久综合给合久久狠狠狠97色69| 久久久国产一区二区| 久久精品三级| 欧美mv日韩mv国产网站app| 欧美成人一区二区三区| 亚洲黑丝在线| 日韩午夜免费| 亚洲欧美日韩国产综合| 欧美一区二区高清| 久久蜜臀精品av| 欧美裸体一区二区三区| 欧美视频在线一区二区三区| 国产精品视频不卡| 禁久久精品乱码| 亚洲麻豆国产自偷在线| 亚洲一区二区三区精品在线观看 | 亚洲欧美中日韩| 久久久久久自在自线| 欧美成人a视频| 亚洲精品自在在线观看| 亚洲一区久久| 久久精品国产亚洲一区二区三区| 久久综合伊人77777麻豆| 欧美精品日韩三级| 国产精品视频第一区| 伊人久久大香线蕉综合热线| 日韩亚洲精品视频| 久久国产精品99精品国产| 欧美激情第9页| 亚洲午夜激情网站| 久热精品在线视频| 欧美视频日韩| 在线观看视频日韩| 亚洲尤物在线视频观看| 久久一综合视频| 一区二区三区日韩精品| 久久久噜噜噜久久久| 国产精品www网站| 激情综合在线| 午夜激情亚洲| 亚洲国内在线| 久久福利视频导航| 欧美视频在线观看一区二区| 尤妮丝一区二区裸体视频| 亚洲欧美日韩天堂一区二区| 欧美成人a∨高清免费观看| 亚洲一区二区少妇| 欧美日本不卡| 亚洲国产精品久久91精品| 久久aⅴ国产欧美74aaa| 亚洲精品美女在线观看播放| 久久久91精品国产一区二区精品| 欧美午夜影院| 9国产精品视频| 欧美激情一区二区三区四区| 欧美在线首页|