|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
|
2008-5-7 19:55 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
Originally posted by 26933062 at 2008-5-7 19:44:
回复 12 楼
不好意识,答案仍不正确,可能是我描述的不够清楚吧。
每个字母的正上方不能是空格。
这么说吧
随机生成第一个字母,比如说是a就把 ...
做到这点并不难,把我12的代码稍做修改就可以实现,但难的是这样就难以满足字符总数为60的要求了,如当第一行的字符仅为一个a时,代码如下:
@echo off&setlocal enabledelayedexpansion
set "str=ab"&set /a a=%random%%%60+1
:begin
set /a b=%random%%%2
set c=!str:~%b%,1!&set var=%var%!c!
set /a n+=1
if %n% lss %a% goto begin
echo 下面为本次生成的字符串:
echo %var%
set "str="&set n=0
:lp
if !n! lss 60 if defined var (
set /a b=%random%%%2
if !b! equ 0 (
set "b= "
) else (
set b=!var:~,1!&set /a n+=1
)
set str=%str%!b!
set var=%var:~1%
goto lp
)
echo.%str%
if !n! lss 60 set var=%str%&set str=&goto lp
pause>nul
Originally posted by 26933062 at 2008-5-7 19:44:
Reply to post 12
Sorry, the answer is still incorrect. Maybe I didn't describe it clearly enough.
The space cannot be directly above each letter.
Let me put it this way
Randomly generate the first letter. For example, if it is a, then...
It's not difficult to do this. You can slightly modify my code in post 12 to achieve it, but the difficulty is that it will then be difficult to meet the requirement of a total of 60 characters. For example, when there is only one a in the first line, the code is as follows:
@echo off&setlocal enabledelayedexpansion
set "str=ab"&set /a a=%random%%%60+1
:begin
set /a b=%random%%%2
set c=!str:~%b%,1!&set var=%var%!c!
set /a n+=1
if %n% lss %a% goto begin
echo The following is the generated string for this time:
echo %var%
set "str="&set n=0
:lp
if !n! lss 60 if defined var (
set /a b=%random%%%2
if !b! equ 0 (
set "b= "
) else (
set b=!var:~,1!&set /a n+=1
)
set str=%str%!b!
set var=%var:~1%
goto lp
)
echo.%str%
if !n! lss 60 set var=%str%&set str=&goto lp
pause>nul
|

批处理之家新域名:www.bathome.net |
|
2008-5-7 20:40 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
呵呵,看来是我的描述出了大问题了。
结果中第一行的字符永远不会比第二行少,第二行永远不会比第三行少。。。。。。。。
Hehe, it seems there's a big problem with my description. The number of characters in the first line in the result is never less than that in the second line, and the number of characters in the second line is never less than that in the third line...
|

致精致简! |
|
2008-5-7 21:14 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
老实说,我是真被你搞晕头了,要不劳兄弟写出代码来吧!
To be honest, I'm really confused by you. Why don't you, brother, write out the code!
|

批处理之家新域名:www.bathome.net |
|
2008-5-7 21:27 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
有这么难理解吗?
老实说,看顶楼的样本应该就知道了,只是把a和b的总数定为60个而以,
zw19750516 兄写的几个代码有哪个是输出顶楼格式的?
Is it really that hard to understand? To be honest, you should know it by looking at the sample in the top post. It's just that the total number of a and b is set to 60. Which of the codes written by brother zw19750516 outputs the format of the top post?
|

致精致简! |
|
2008-5-7 21:33 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
那是我理解不好,就请兄弟写出代码来看看吧!
That's because I didn't understand it well. Just please brother write out the code to take a look!
|

批处理之家新域名:www.bathome.net |
|
2008-5-7 21:55 |
|
|
pusofalse
银牌会员
    
积分 1604
发帖 646
注册 2008-4-13
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
ababababababababa
xbxbxxabaxxbaxxxa
xbxxxxaxaxxbaxxxx
xxxxxxaxaxxbaxxxx
xxxxxxxxaxxbxxxxx
xxxxxxxxxxxbxxxxx
x代表空格
比如第一行的第2个字符是b 到了第四行时第2个字符成了空格。。。 到了第5行的第二个字符 也必须是空格 如果是在第三行时变成空格,那以后的行,第二的位置上也必须是空格
不知我这样说 能否明白~~^_^
abababababababababa
xbxbxxabaxxbaxxxa
xbxxxxaxaxxbaxxxx
xxxxxxaxaxxbaxxxx
xxxxxxxxaxxbxxxxx
xxxxxxxxxxxbxxxxx
x represents a space. For example, the second character in the first line is b, but in the fourth line, the second character becomes a space... In the fifth line, the second character must also be a space. If it becomes a space in the third line, then in subsequent lines, the second position must also be a space. I wonder if you can understand what I'm saying~~^_^
|
|
2008-5-7 22:21 |
|
|
terse
银牌会员
    
积分 2404
发帖 946
注册 2005-9-8
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
领会错误 删贴
Last edited by terse on 2008-5-7 at 11:10 PM ]
Misunderstood and deleted the post
Last edited by terse on 2008-5-7 at 11:10 PM ]
|

简单!简单!再简单! |
|
2008-5-7 22:22 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
Originally posted by pusofalse at 2008-5-7 22:21:
ababababababababa
xbxbxxabaxxbaxxxa
xbxxxxaxaxxbaxxxx
xxxxxxaxaxxbaxxxx
xxxxxxxxaxxbxxxxx
xxxxxxxxxxxbxxxxx
x代表空格
比如第一行的第2个字符是b 到了第四行时第2个字符 ...
如是这样,请运行我17的代码。
Originally posted by pusofalse at 2008-5-7 22:21:
ababababababababa
xbxbxxabaxxbaxxxa
xbxxxxaxaxxbaxxxx
xxxxxxaxaxxbaxxxx
xxxxxxxxaxxbxxxxx
xxxxxxxxxxxbxxxxx
x represents a space
For example, the 2nd character of the first line is b, and by the fourth line, the 2nd character...
If it is like this, please run my code of 17.
|

批处理之家新域名:www.bathome.net |
|
2008-5-7 22:24 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
希望可以换个90的思维……问题就简单些了……
Hope to change to a 90s way of thinking... The problem will be simpler...
|
|
2008-5-7 22:27 |
|
|
pusofalse
银牌会员
    
积分 1604
发帖 646
注册 2008-4-13
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
Originally posted by zw19750516 at 2008-5-7 10:24 PM:
如是这样,请运行我17的代码。
嗯,如果是没有个数限制的情况下确实是这样。。。但是真是不好意思~ 我刚才又忘记说了,ab个数加起来要等于60
各位前辈的执着与钻研精神 真是佩服至极!
Originally posted by zw19750516 at 2008-5-7 10:24 PM:
If that's the case, please run my code at 17.
Hmm, if there is no limit on the number of elements, indeed it is like this... But I'm really sorry~ I just forgot to mention again that the sum of the number of a and b should be equal to 60.
The perseverance and research spirit of all the seniors are really admirable!
|
|
2008-5-7 22:41 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
&&那我只能说这道题目出得有问题了,要同时满足随机生成字符串和递减输出以及输出字符总数(不包括原始字符串和空格)为60个这三个条件是很难做到的。
这要看第一:原始生成的字符串字符数多不多,如生成只一个字符的原始字符串看誰能保证以后59行每行都不生成空格。
还要看第二:每行生成的空格数多不多了,如果在第一行就生成了30个以上的空格,输出字符总数为60个的条件怕是难以保住了吧。
&&Then I can only say that there is a problem with this question. It is very difficult to meet the three conditions of randomly generating strings, decreasing output, and the total number of output characters (excluding the original string and spaces) being 60.
This depends on the first point: whether the number of characters in the originally generated string is large. For example, if the originally generated string has only one character, see who can ensure that no spaces are generated in the next 59 lines.
Also depends on the second point: whether the number of spaces generated in each line is large. If more than 30 spaces are generated in the first line, it is恐怕 difficult to maintain the condition that the total number of output characters is 60.
|

批处理之家新域名:www.bathome.net |
|
2008-5-7 23:02 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
回复23楼 terse
你的代码也不对,每行的横向是不可能出现重复字母的,比如 bb或aa 应该是abababab 或 bababa 并且你的代码好像会显示很多多余的空行。。
a和b的总数是60个,但哪个位置是a哪个位置是b不是确定的,是随机的。
但左右相邻的是不能重复,比如 bb 就不行,除非是b空格b,但第一行是不能有空格的。而所有的纵向是必须一样的。
Reply to post 23: terse
Your code is also incorrect. It's impossible to have duplicate letters horizontally in each row, like "bb" or "aa". It should be "abababab" or "bababa". Also, your code seems to display many redundant blank lines.
The total number of "a" and "b" is 60, but which positions are "a" and which are "b" is random.
However, adjacent left and right cannot be repeated, like "bb" is not allowed, unless it's "b space b", but the first row cannot have spaces. And all vertical rows must be the same.
|

致精致简! |
|
2008-5-7 23:08 |
|
|
pusofalse
银牌会员
    
积分 1604
发帖 646
注册 2008-4-13
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
解铃还需系铃人。。。 到批处理之家看看吧,但貌似现在还没有给出源码,那里的版主也是超强的,只是没有时间上网而已
The person who tied the bell on the tiger must take it off.... Go to Batch Processing Home to have a look, but it seems that the source code hasn't been provided yet. The moderators there are also extremely powerful, just that they don't have time to surf the Internet.
|
|
2008-5-7 23:13 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
算法问题……我想论坛里高手还是可以解决的。
a和b总共60个?你给的输出貌似不够吧?
Algorithm problem... I think the experts in the forum should still be able to solve it.
a and b total 60? The output you provided seems insufficient?
|
|
2008-5-7 23:19 |
|