×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

给大家出一个JAVA的练习题,看看谁能做出来

本文发表在 rolia.net 枫下论坛Simple Simon decided to invent a Hypertext Paint Protocol. To keep the language simple, he restricted himself to just 5 control tags:

<Un> go up n lines of text.
<Dn> go down n lines of text.
<Ln> go left n spaces of text.
<Rn> go right n spaces of text.
<Mn> repeat the last character n times,

in order to actually print < or > preceed the character with a ?. Of course that goes for ? itself also.
For example, in order to print: “>” you type “?>” and if you wanted to print: “?” you type “??”
for example,

?<345?><D1><L6>-<M7><D1><L6>?<678?>

would print:

<345>
-------
<678>

DATA21.txt (DATA22.txt for the second try) contains 5 lines containing samples of Simple Simon’s HTPP text: Each of the input lines contains no more than 100 characters.

Write a program that will print the text as shown in the samples output below. Note that the text will never stray more than 12 characters above or below the starting point, and never more than 39 characters to its left or right.

Under suitable input control, display each of the 5 outputs on a cleared screen or window.



Sample Input:



?<345?><D1><L6>-<M7><D1><L6>?<678?> ^ ^<D1><L3>0 0<D2><L4>?<<U1><R1>L<D1>-<L3>--<R1>?> !-<M8>?<+<M3>?>-<M6>?<=<M4>?>-<M11>! X<D1>X<M7><U1>X<U1><L1>X<U1><L1>X<U1><L1>X<U1><L1>X<U1><L1>X<U1><L1>X<U1><L2>X<M3> ?<M12?> means repeat 12 times<L27><U1>?<U3?> means up 3 spaces

Sample Output:


<345>
-------
<678>




^ ^
0 0
L
<--->






!--------<+++>------<====>-----------!






XXX
X
X
X
X
X
X
X X
XXXXXXX




<U3> means up 3 spaces
<M12> means repeat 12 times更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report