中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-09 02:17
47,812 topics / 349,914 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » Symmetric output bonus question (challenging)
Printable Version  4,819 / 64
Floor1 bat-zw Posted 2008-07-10 21:16
金牌会员 Posts 1,276 Credits 3,105

-----------------------------------
There is the following corresponding relationship:
0123456789 | abcdefghij
It is required to write an interactive batch processing.
-----------------------------------
When inputting 7, the output is as follows:
#######7## | ##c#######
When inputting a5, the output is as follows:
#####5###9 | a###e#####
When inputting 12j, the output is as follows:
012####### | #######hij
-----------------------------------
1 I will give points according to the problem-solving ideas and skills (focusing on ideas).
2 If you don't want to deal with special characters, you can omit the middle | and not output it.
3 Please pay attention to the generality of the code when solving the problem, and try to keep the code concise (consider the problem complicated, and solve the problem simply).
4 When interacting with the human-computer interface for input, you can try to provide convenience for problem-solving as much as possible.
5 There is no need to write the code part for judging the input characters.
-----------------------------------

-----------------------------------
Brother pusofalse was the first to solve this problem on the 15th floor, but his code is obviously too complicated and not general, so only 1 point is added.
I also gave a solution on the 25th floor (the code is still a bit complicated).
There are already multiple solutions (10th floor, 25th floor, 26th floor, 28th floor, 29th floor, 35th floor, 37th floor, 38th floor...),
I still tend to the solution given on the 28th floor (the best solution still needs everyone to evaluate), the code is as follows:

I think this code has the characteristics of clear ideas, generality, conciseness, efficiency and so on.
Hereby recommend the code of brother terse as follows:

-----------------------------------
Thank you all for your enthusiastic responses to this post, but the only thing that is insufficient is that basically they are all senior members (quya laotu is actually also a veteran member), and there are few traces of new people. I hope that new people all have the spirit of being brave to challenge, and the original intention of me constantly setting questions is also for this.
-----------------------------------
[ Last edited by zw19750516 on 2008-7-13 at 09:44 AM ]
Floor2 26933062 Posted 2008-07-10 21:41
银牌会员 Posts 879 Credits 2,268
Is it possible to input a situation where letters and numbers are interleaved, like 2a5f?
Floor3 bat-zw Posted 2008-07-10 21:42
金牌会员 Posts 1,276 Credits 3,105
It's possible, and it doesn't affect anything.
Floor4 wxcute Posted 2008-07-10 22:18
中级用户 Posts 211 Credits 458
What about inputting e5?

==!
It's quite difficult and requires a lot of mental effort.

[ Last edited by wxcute on 2008-7-10 at 10:29 PM ]
Floor5 pusofalse Posted 2008-07-10 22:27
银牌会员 Posts 646 Credits 1,604
This question doesn't seem to be for beginners.
Floor6 26933062 Posted 2008-07-10 22:38
银牌会员 Posts 879 Credits 2,268
It's really brain - consuming. Finally, it's written. The code is relatively bloated. Let's take a look at the novices'...
Floor7 HAT Posted 2008-07-10 22:41
版主 Posts 5,017 Credits 9,023
The first reaction is to reverse the string, I don't know if the idea is correct.
Floor8 bat-zw Posted 2008-07-10 23:02
金牌会员 Posts 1,276 Credits 3,105
Originally posted by HAT at 2008-7-10 22:41:
The first reaction is to reverse the string, not sure if the idea is correct.

This idea is correct, but there are various solutions.
Floor9 26933062 Posted 2008-07-10 23:10
银牌会员 Posts 879 Credits 2,268
There are so many varieties, and just one variety has already made my head big...
Floor10 pusofalse Posted 2008-07-11 00:37
银牌会员 Posts 646 Credits 1,604
It's really difficult... But almost successful, it's complicated, way too complicated...
Floor11 bat-zw Posted 2008-07-11 00:47
金牌会员 Posts 1,276 Credits 3,105
Hehe, when I first came up with this question, I didn't expect it to be so difficult!
Floor12 pusofalse Posted 2008-07-11 01:26
银牌会员 Posts 646 Credits 1,604
Finally succeeded... Nearly 4 hours of effort... - -|||
Complicated...
Floor13 bat-zw Posted 2008-07-11 01:42
金牌会员 Posts 1,276 Credits 3,105
Originally posted by pusofalse at 2008-7-11 01:26:
Finally succeeded... Nearly 4 hours of effort... - -|||
Complicated...

Bro, did you think it was too complicated?
ps: You can post your code.

[ Last edited by zw19750516 on 2008-7-11 at 01:44 AM ]
Floor14 pusofalse Posted 2008-07-11 01:44
银牌会员 Posts 646 Credits 1,604
Maybe...I didn't have any ideas for more than an hour...
Floor15 pusofalse Posted 2008-07-11 01:45
银牌会员 Posts 646 Credits 1,604
Originally posted by zw19750516 at 2008-7-11 01:42 AM:

Is the brother overcomplicating things?
ps: You can post your code.

[ Last edited by zw19750516 on 2008-7-11 at 01:44 AM ]

Maybe... I had no idea for more than an hour...
After writing it and taking a look, there's no new idea...

1 2 3 45  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023