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

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 閱讀(745) 評論(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>
            欧美一区二区三区四区在线观看| 伊人精品久久久久7777| 在线一区二区三区做爰视频网站| 国产婷婷97碰碰久久人人蜜臀| 欧美视频在线观看一区二区| 欧美日韩一区二区三区在线| 国产精品v欧美精品∨日韩| 欧美日韩三区| 国产欧美日韩综合| 激情伊人五月天久久综合| 韩国欧美一区| 日韩午夜在线视频| 亚洲一区二区动漫| 翔田千里一区二区| 欧美资源在线观看| 蜜桃av久久久亚洲精品| 91久久久久久久久久久久久| 欧美高清不卡| 一级成人国产| 欧美一区二区三区免费观看视频| 久久精品一区| 欧美日韩国产成人在线91| 欧美日韩一区二区三区四区在线观看| 国产精品视频在线观看| 精品二区视频| 中文在线一区| 麻豆精品视频在线观看视频| 亚洲精品影院在线观看| 欧美亚洲一区二区三区| 欧美粗暴jizz性欧美20| 国产精品影视天天线| 亚洲电影成人| 夜夜嗨av一区二区三区免费区| 欧美一激情一区二区三区| 久久久国产视频91| 亚洲国产精品久久人人爱蜜臀| 日韩一区二区久久| 久久国产精品毛片| 欧美性大战久久久久久久| 娇妻被交换粗又大又硬视频欧美| 一区二区欧美日韩| 欧美成人午夜激情| 亚洲一二三区精品| 久久综合网色—综合色88| 欧美日韩一区二区三区四区在线观看 | 国内精品久久久久影院薰衣草| 日韩视频中午一区| 久久精品国产免费| 亚洲精品国产拍免费91在线| 欧美一区三区三区高中清蜜桃| 欧美另类人妖| 亚洲日韩欧美视频| 久久综合狠狠| 羞羞色国产精品| 国产精品劲爆视频| 日韩亚洲欧美中文三级| 欧美不卡一卡二卡免费版| 亚洲免费影视第一页| 欧美日韩一二三区| 99精品国产在热久久| 欧美成人精品福利| 久久久www成人免费无遮挡大片| 国产精品美女久久久久av超清| 一本色道久久综合一区| 亚洲高清不卡| 免费日韩精品中文字幕视频在线| 国产精品激情| 欧美影院一区| 亚洲一区二区在线播放| 国产精品视频1区| 亚洲欧美成人一区二区在线电影| 亚洲欧洲午夜| 欧美激情成人在线| 亚洲黄色av一区| 欧美成在线视频| 欧美大片在线观看一区二区| 亚洲精品午夜精品| 亚洲精品少妇网址| 国产精品第三页| 午夜激情一区| 欧美一区二区高清| 狠狠色丁香婷婷综合| 免费成年人欧美视频| 欧美福利视频在线| 亚洲视频精品在线| 亚洲欧美久久久| 精品动漫3d一区二区三区| 亚洲男女毛片无遮挡| 亚洲男人av电影| 国产精品久久久久久久久久直播 | 尤物网精品视频| 亚洲成色777777在线观看影院 | 国产综合亚洲精品一区二| 久久夜色精品国产欧美乱极品| 久久久久久久久伊人| 亚洲精品在线观看免费| 日韩午夜电影| 国产婷婷色一区二区三区| 美日韩免费视频| 欧美午夜视频在线| 久久久久国产精品厨房| 美女精品在线| 亚洲一区免费在线观看| 久久大综合网| 99精品欧美| 久久精品国产久精国产爱| 日韩一级片网址| 欧美一级片久久久久久久| 在线欧美日韩国产| 一本色道久久综合亚洲精品不| 国产一区二区三区四区| 亚洲另类自拍| 永久免费毛片在线播放不卡| 一区二区国产日产| 亚洲成人在线视频播放| 国产精品99久久久久久宅男| 国产农村妇女精品一二区| 亚洲风情亚aⅴ在线发布| 国产精品美女久久久免费| 欧美aaa级| 国产亚洲欧美日韩精品| 亚洲美女尤物影院| 亚洲国产日韩欧美一区二区三区| 亚洲午夜三级在线| 亚洲精选在线观看| 久久蜜桃资源一区二区老牛 | 欧美一区二区三区成人| 欧美精品18+| 嫩草伊人久久精品少妇av杨幂| 国产欧美日韩精品在线| 一区二区毛片| 日韩一二在线观看| 欧美大香线蕉线伊人久久国产精品| 亚洲一区亚洲| 欧美精品首页| 欧美激情精品久久久久久大尺度| 国产视频亚洲精品| 亚洲在线视频| 亚洲欧美中文日韩v在线观看| 欧美日韩免费在线观看| 亚洲激情成人在线| 国产精品欧美在线| 国产一区在线播放| 午夜久久tv| 欧美亚洲在线播放| 国产精品夜夜夜| 亚洲资源av| 久久国产99| 国模一区二区三区| 久久久999成人| 狂野欧美一区| 在线不卡a资源高清| 久久精品论坛| 欧美第一黄色网| 亚洲人成精品久久久久| 欧美精品1区| 国产精品99久久99久久久二8| 亚洲中无吗在线| 国产精品国产三级国产普通话99 | 久久久久88色偷偷免费| 免费观看一区| 亚洲精品在线二区| 欧美色偷偷大香| 亚洲欧美日韩一区| 美女黄色成人网| 日韩亚洲一区二区| 国产精品婷婷| 欧美中文在线观看| 农夫在线精品视频免费观看| 亚洲国产一区二区三区a毛片| 欧美激情综合在线| 亚洲色图自拍| 久久天堂成人| 亚洲最新视频在线播放| 国产精品久久久久久久久果冻传媒| 午夜精品亚洲一区二区三区嫩草| 久久综合给合久久狠狠狠97色69| 日韩一区二区免费高清| 国产伦精品一区二区三区免费迷| 久久精品亚洲一区二区| 亚洲人体一区| 久久九九国产精品怡红院| 亚洲人成高清| 国产亚洲精品v| 欧美精品一区二区三区蜜臀| 午夜日韩av| 99国产精品久久久久久久| 久久国产婷婷国产香蕉| 99re66热这里只有精品3直播| 国产欧美日韩一区| 欧美日韩另类视频| 久久久久久久欧美精品| 亚洲在线观看| 日韩图片一区| 亚洲国产精品一区二区第一页| 久久av最新网址| 亚洲性人人天天夜夜摸| 亚洲国产日日夜夜| 国内成+人亚洲| 国产精品magnet|