|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
不错。对算法有研究。
Not bad. Have research on algorithms.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-13 21:08 |
|
|
kennyfan
中级用户
  
积分 259
发帖 112
注册 2006-9-18
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
哇..深入...学习ing!!!
Wow..In-depth...Learninging!!!
|
|
2006-11-13 22:08 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
为了促进算法研究,,,呵呵。。
有一个五位奇数,将这个五位奇数中的所有2都换成5,所有5也都换成2,其他数保持不变,得到一个新的五位数,若新五位数的一半仍比原五位数大1,那么原五位数是多少?
To promote algorithm research, heh heh.
There is a five-digit odd number. Replace all 2s with 5s and all 5s with 2s in this five-digit odd number, while keeping other digits unchanged, to get a new five-digit number. If half of the new five-digit number is still 1 more than the original five-digit number, what is the original five-digit number?
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-11-15 00:26 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
哈哈……有意思~:)
可以开批处理与数据结构算法专版了~:)
Haha... Interesting~ :)
Can start a batch processing and data structure algorithm special section~ :)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-15 00:42 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
五个连续自然数的和分别能被2、3、4、5、6整除,求满足此条件的最小的一组数。
The sum of five consecutive natural numbers can be divided by 2, 3, 4, 5, and 6 respectively. Find the smallest set of such numbers that meets the condition.
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-11-15 02:25 |
|
|
Michale
初级用户
 
积分 52
发帖 27
注册 2006-10-6 来自 ☆逍遥宫☆
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
不错~~看了那么的处理~~觉得楼上的几个处理蛮漂亮的~~值得大家一起来研究研究~~谢谢大家~~~
Not bad~~After seeing so many treatments~~I think the several treatments upstairs are quite beautiful~~worthy of everyone's joint research~~Thank you all~~~
|
|
2006-11-15 03:56 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
建议 zouzhxi 把所有的问题都集中在顶楼,以 序号+内容 的格式列出来,每解决一个,就在这个序号后做个标记或者说明,这样就能让大家看到这个帖子都有哪些有意思的话题。
It is suggested that zouzhxi concentrate all issues in the top in the format of serial number + content listed. Once solved, make a mark or instruction behind this serial number, so that everyone can see which interesting topics are in this post.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-15 06:36 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
终于又回来了!
回18楼,答案是:29995。
给出的测试代码:
@echo off & echo 正在检测数据...
setlocal enabledelayedexpansion
for /l %%a in (0 1 9) do (
for /l %%b in (0 1 9) do (
for /l %%c in (0 1 9) do (
set/a Fnum=2%%a%%b%%c5
set Bnum=!Fnum:5=A!
set Bnum=!Bnum:2=5!
set/a Bnum=!Bnum:A=2!
set/a Fnum_=2*!Fnum!+2
if !Bnum! EQU !Fnum_! echo !Fnum!
)))
echo 检测完毕!
pause>nul
说明:该程序在XP pro sp2下测试通过。
解决这个问题,首先我们要明确这个数字结尾必须是5,因为只有这样,才可以在转化后才是偶数,才可以被2整除;而且首位数字必须是2......
Last edited by youxi01 on 2006-11-16 at 11:38 PM ]
Finally back again!
Reply to post 18, the answer is: 29995.
The test code given:
@echo off & echo Checking data...
setlocal enabledelayedexpansion
for /l %%a in (0 1 9) do (
for /l %%b in (0 1 9) do (
for /l %%c in (0 1 9) do (
set/a Fnum=2%%a%%b%%c5
set Bnum=!Fnum:5=A!
set Bnum=!Bnum:2=5!
set/a Bnum=!Bnum:A=2!
set/a Fnum_=2*!Fnum!+2
if !Bnum! EQU !Fnum_! echo !Fnum!
)))
echo Checking completed!
pause>nul
Explanation: This program was tested and passed under XP pro sp2.
To solve this problem, first we need to clarify that the number must end with 5, because only in this way, after conversion, it will be an even number and can be divided by 2; and the first digit must be 2......
Last edited by youxi01 on 2006-11-16 at 11:38 PM ]
|
|
2006-11-15 07:24 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
答20楼:答案是10 11 12 13 14
@echo off
echo 正在检测数据....
setlocal enabledelayedexpansion
for /l %%i in (1 1 10000) do (
set /a flag=0
set /a num=5*%%i+10
set /a num1=!num!%%4
set /a num2=!num!%%5
set /a num3=!num!%%6
for %%a in (!num1! !num2! !num3!) do (
if %%a NEQ 0 set /a flag=1
)
if !flag! EQU 0 set /a num=%%i & goto :exit
)
:exit
for /l %%i in (0 1 4) do (
set /a num%%i=%num%+%%i
)
echo 要求的连续的5个自然数为:%num0% %num1% %num2% %num3% %num4%
pause>nul
xp pro sp2下测试通过。
Last edited by youxi01 on 2006-11-16 at 11:38 PM ]
Answer to post 20: The answer is 10 11 12 13 14
@echo off
echo Detecting data....
setlocal enabledelayedexpansion
for /l %%i in (1 1 10000) do (
set /a flag=0
set /a num=5*%%i+10
set /a num1=!num!%%4
set /a num2=!num!%%5
set /a num3=!num!%%6
for %%a in (!num1! !num2! !num3!) do (
if %%a NEQ 0 set /a flag=1
)
if !flag! EQU 0 set /a num=%%i & goto :exit
)
:exit
for /l %%i in (0 1 4) do (
set /a num%%i=%num%+%%i
)
echo The required consecutive 5 natural numbers are: %num0% %num1% %num2% %num3% %num4%
pause>nul
Tested and passed under XP Pro SP2.
Last edited by youxi01 on 2006-11-16 at 11:38 PM ]
|
|
2006-11-15 07:46 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
应namejm的要求:
#序号 !解决 ?未解决
#01 !
求水仙花数?
#02 !
有四个数,其中任意三个数相加,所得的和分别是84,88,99,110,求这四个数?
#03 !
赵姑娘的岁数有以下特点:
1. 它的3次方是一个四位数,而4次方是一个六位数;
2. 这四位数和六位数正好是0到9这十个数字组成.
问,这个数应该是什么数?
#04 !
排一本辞典的页码共用了4889个数字。这本辞典共有多少页? 答案:1499
#05 !
阿聪说他这次去西北看见一群骆驼,共有23个驼峰,60只脚。请问单、双峰骆驼各多少只?
#06 !
有一个五位奇数,将这个五位奇数中的所有2都换成5,所有5也都换成2,其他数保持不变,得到一个新的五位数,若新五位数的一半仍比原五位数大1,那么原五位数是多少?
#07 !
五个连续自然数的和分别能被2、3、4、5、6整除,求满足此条件的最小的一组数。
#08 !
我是个三位数,其中有一个数字是“3”,还有一个数字是“1”,另一个数字是未知数。如果把“3”变成“4”、把“1”变成“3”,那么,原来的我将比假设后的我的一半还少“9”。你知道原来是个什么数?
#09 ?
农夫琼斯对他老婆说:"喂,玛丽亚,如果照我的办法,卖掉75只小鸡,那么咱们的鸡饲料还能维持20夭。然而,假使照你的建议,再买进100只小鸡的话,那么鸡饲料将只够维持15天。"
"啊,亲爱的,"她答道,"那我们现在有多少只小鸡呢?"
问题就在这里了,他们究竟有多少只小鸡?
#10 !
在所有的5位数当中,只包含两个3的数字有多少个?
#11 !
将17分成几个自然数的和,求这几个自然数的最大乘积是多少?
#12 ?
将自然数2、3......乘到一起,它们的积的最后6位数恰好都是0,最后一个自然数最少可能是几?
#13 !
被除数、除数和商三个数的和是181,商是12,求被除数。
#14 ?
商店里有六箱货物,分别重15、16、18、19、20、31千克,两个顾客买走了其中五箱.已知一个顾客买的货物重量是另一个顾客的2倍,那么,商店剩下的一箱货物重量是多少千克?
#15 ?
一个数除以3的余数是2,除以5的余数是1,则这个数除以15的余数是多少?
#16 ?
1. p是质数,且p×p+1也是质数。求2006×p。
2. 2006个2的乘积除以7的余数是多少。
Last edited by zouzhxi on 2006-11-15 at 09:39 PM ]
At the request of namejm:
#Serial number! Solved? Unsolved
#01!
Find narcissistic numbers?
#02!
There are four numbers. When any three numbers are added together, the resulting sums are 84, 88, 99, 110 respectively. Find these four numbers?
#03!
Miss Zhao's age has the following characteristics:
1. Its cube is a four-digit number, and its fourth power is a six-digit number;
2. These four-digit number and six-digit number exactly consist of the ten digits from 0 to 9.
Ask, what number should this be?
#04!
A total of 4889 digits were used to number the pages of a dictionary. How many pages does this dictionary have? Answer: 1499
#05!
Acong said that he saw a group of camels in the northwest this time. There are 23 humps and 60 feet. How many single-humped and double-humped camels are there respectively?
#06!
There is a five-digit odd number. Replace all 2s with 5s and all 5s with 2s in this five-digit odd number, and keep other numbers unchanged to get a new five-digit number. If half of the new five-digit number is still 1 greater than the original five-digit number, what is the original five-digit number?
#07!
The sum of five consecutive natural numbers can be divisible by 2, 3, 4, 5, 6 respectively. Find the smallest set of numbers that meets this condition.
#08!
I am a three-digit number. There is one digit that is "3", another digit is "1", and the other digit is unknown. If "3" is changed to "4" and "1" is changed to "3", then the original me will be 9 less than half of the assumed me. Do you know what I was originally?
#09?
Farmer Jones said to his wife: "Hey, Maria, if I sell 75 chicks according to my way, then our chicken feed can last for 20 days. However, if I follow your suggestion and buy 100 more chicks, then the chicken feed will only last for 15 days."
"Ah, dear," she replied, "then how many chicks do we have now?"
The problem is here. How many chicks do they have exactly?
#10!
Among all five-digit numbers, how many have exactly two 3s?
#11!
Divide 17 into the sum of several natural numbers. What is the maximum product of these natural numbers?
#12?
Multiply natural numbers 2, 3... together. The last 6 digits of their product are exactly all 0s. What is the minimum possible value of the last natural number?
#13!
The sum of the dividend, divisor and quotient is 181, and the quotient is 12. Find the dividend.
#14?
There are six boxes of goods in the store, weighing 15, 16, 18, 19, 20, 31 kilograms respectively. Two customers bought five of them. It is known that the weight of the goods bought by one customer is twice that of the other customer. Then, what is the weight of the remaining box of goods in the store?
#15?
A number has a remainder of 2 when divided by 3 and a remainder of 1 when divided by 5. What is the remainder of this number when divided by 15?
#16?
1. p is a prime number, and p×p + 1 is also a prime number. Find 2006×p.
2. What is the remainder when the product of 2006 2s is divided by 7?
Last edited by zouzhxi on 2006-11-15 at 09:39 PM ]
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-11-15 08:10 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
Originally posted by youxi01 at 2006-11-14 18:24:
解决这个问题,首先我们要明确这个数字结尾必须是5,因为只有这样,才可以在转化后才是偶数,才可以被2整除;而且首位数字必须是2......
23F的思路有缺陷,因为我们要做的,就是用代码来模拟题意,如果能直接推出某些条件,则可以充分利用这些条件;如果需要经过两步以上的推理才能得出的条件,最好不要使用,而应交给代码来处理;否则,既然经过两步推理得出的条件可以使用,那么,三步的呢?四步的呢?N步的呢?最后一步不就包含在第N步中么?那样的话,我们完全可以把需要经过N步才能得出的结论直接写出来,从而完全抛弃代码——虽然最后你的结果是正确的,但是建议不要这样做。
在23F的基础上,给出一个解决18F的问题、尽量模拟题意的代码(速度很慢):
@echo off
setlocal enabledelayedexpansion
for /l %%i in (10001,2,99999) do (
set num=%%i
set num=!num:5=a!
if not "!num!"=="%%i" (
set num_tmp1=!num!
set num=!num:2=5!
if not "!num!"=="!num_tmp1!" (
set num=!num:a=2!
set /a num_tmp2=2*%%i+2
if !num! equ !num_tmp2! echo %%i
)
)
)
pause
再给出一个比较快一点的代码:
@echo off
setlocal enabledelayedexpansion
for /l %%i in (10005,5,99995) do (
set num=%%i
set num=!num:5=a!
if not "!num!"=="%%i" (
set num_tmp1=!num!
set num=!num:2=5!
if not "!num!"=="!num_tmp1!" (
set num=!num:a=2!
set /a num_tmp2=2*%%i+2
if !num! equ !num_tmp2! echo %%i
)
)
)
pause
23F的代码可精简为:
@echo off
setlocal enabledelayedexpansion
for /l %%i in (20005,5,29995) do (
set num=%%i
set num=!num:5=a!
set num=!num:2=5!
set num=!num:a=2!
set /a num_tmp=2*%%i+2
if !num! equ !num_tmp! echo %%i
)
pause
Last edited by namejm on 2006-11-15 at 12:57 PM ]
Originally posted by youxi01 at 2006-11-14 18:24:
To solve this problem, first we need to clarify that the number must end with 5, because only in this way can it be an even number after conversion and be divisible by 2; and the first digit must be 2...
The idea of 23F has flaws, because what we need to do is to simulate the problem statement with code. If we can directly deduce certain conditions, we can make full use of these conditions; if the conditions need to be deduced through more than two steps of reasoning, it is better not to use them and should be left to the code to handle; otherwise, since the conditions deduced through two steps of reasoning can be used, then what about three steps? Four steps? N steps? The last step is just included in the Nth step? In that case, we can completely write out the conclusion that needs to be deduced through N steps and thus completely abandon the code - although your result is correct in the end, it is suggested not to do this.
Based on 23F, here is a code that solves the problem of 18F and tries to simulate the problem statement (very slow):
@echo off
setlocal enabledelayedexpansion
for /l %%i in (10001,2,99999) do (
set num=%%i
set num=!num:5=a!
if not "!num!"=="%%i" (
set num_tmp1=!num!
set num=!num:2=5!
if not "!num!"=="!num_tmp1!" (
set num=!num:a=2!
set /a num_tmp2=2*%%i+2
if !num! equ !num_tmp2! echo %%i
)
)
)
pause
Then here is a faster code:
@echo off
setlocal enabledelayedexpansion
for /l %%i in (10005,5,99995) do (
set num=%%i
set num=!num:5=a!
if not "!num!"=="%%i" (
set num_tmp1=!num!
set num=!num:2=5!
if not "!num!"=="!num_tmp1!" (
set num=!num:a=2!
set /a num_tmp2=2*%%i+2
if !num! equ !num_tmp2! echo %%i
)
)
)
pause
The code of 23F can be simplified as:
@echo off
setlocal enabledelayedexpansion
for /l %%i in (20005,5,29995) do (
set num=%%i
set num=!num:5=a!
set num=!num:2=5!
set num=!num:a=2!
set /a num_tmp=2*%%i+2
if !num! equ !num_tmp! echo %%i
)
pause
Last edited by namejm on 2006-11-15 at 12:57 PM" ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-15 08:10 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
对于楼上的斑竹的 “因为我们要做的,就是用代码来模拟题意,如果能直接推出某些条件,则可以充分利用这些条件;如果需要经过两步以上的推理才能得出的条件” 的说法,在下不敢苟同!
我曾经用(纯)批处理写过一篇求100000之内的素数的问题,如果根据楼上的说法,模拟题意的话,那写出的代码运行效率实在是不敢恭维!
对于一些推导性的结论,特别是比较快速的可以推导的结论,我觉得就都可以运用。
I can't agree with the statement of the "moderator" above: "Because what we need to do is to simulate the problem with code. If we can directly derive some conditions, we can make full use of these conditions; if conditions that need more than two steps of reasoning to be obtained".
I once wrote a problem of finding prime numbers within 100,000 with (pure) batch processing. According to the statement above, if we simulate the problem, the running efficiency of the written code is really not to be praised!
For some derivable conclusions, especially those that can be derived quickly, I think they can all be applied.
|
|
2006-11-15 08:18 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
呵呵,不敢苟同的做法是对的,因为我没有说出我的前提条件:当我们要研究某些通用算法的时候,应该尽量模拟题意写代码;如果是写应用型的脚本,基于效率优先的原则,则可以充分利用一切可以正确推导出来的条件——在这里之所以提出尽量模拟的说法,是因为我们在这里主要讨论的是通用算法。当然,并不意味着要排斥技巧性非常强的代码。
Hehe, the approach of not agreeing is correct because I didn't state my precondition: when we want to study certain algorithms, we should try to write code simulating the problem statement; if it's writing scripts, based on the principle of , we can make full use of all correctly derivable conditions - the reason for proposing the statement of trying to simulate here is because we are mainly discussing general algorithms here. Of course, it doesn't mean excluding highly technical code.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-15 08:31 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
在用批处理玩数字游戏的时候,要注意数字的范围哦,超过就会溢出了。
-2147483648——2147483647 (WINDOWS XP SP2 @ CMD Shell)
When playing number games with batch processing, you need to pay attention to the range of numbers, otherwise overflow will occur.
-2147483648——2147483647 (WINDOWS XP SP2 @ CMD Shell)
|
|
2006-11-15 09:27 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
不错,好多问题了!先回答几题!
第八题:
@echo off
rem 经推算,首位数字必须为1,(除非未知数为1,为1的情况在第一个for中也处理了)
setlocal enabledelayedexpansion
for /l %%i in (0 1 9) do (
set /a Fnum=1%%i3
set /a Bnum=3%%i4
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)
for /l %%i in (0 1 9) do (
set /a Fnum=13%%i
set /a Bnum=34%%i
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)
pause>nul
第九题:
@echo off
rem 小鸡的只数至少有76只:
setlocal enabledelayedexpansion
for /l %%i in (76 1 10000) do (
set /a Fnum=%%i*20-75*20
set /a Bnum=%%i*15+100*15
if !Fnum! EQU !Bnum! echo 小鸡的只数为:%%i & goto :exit)
:exit
pause>nul
第十题:来一个比较巧一点的办法:(效率可能相对要高,没测试!)
@echo off
echo 正在检测数据........
setlocal enabledelayedexpansion
set /a flag=0
for /l %%i in (10000,1,99999) do (
set num=%%i
rem 前面加个1是为了防止类似30820的特殊情况。
set /a num=1!num:3=!
if !num! lss 2000 if !num! gtr 200 set /a flag+=1)
echo %flag%
echo 检测完毕!
pause>nul
Last edited by youxi01 on 2006-11-16 at 11:41 PM ]
Not bad, there are many questions! Let's answer a few first!
### Question 8:
```
@echo off
rem After deduction, the first digit must be 1, (unless the unknown number is 1, and the case where it is 1 is also handled in the first for)
setlocal enabledelayedexpansion
for /l %%i in (0 1 9) do (
set /a Fnum=1%%i3
set /a Bnum=3%%i4
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)
for /l %%i in (0 1 9) do (
set /a Fnum=13%%i
set /a Bnum=34%%i
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)
pause>nul
```
### Question 9:
```
@echo off
rem The number of chicks is at least 76:
setlocal enabledelayedexpansion
for /l %%i in (76 1 10000) do (
set /a Fnum=%%i*20-75*20
set /a Bnum=%%i*15+100*15
if !Fnum! EQU !Bnum! echo The number of chicks is: %%i & goto :exit)
:exit
pause>nul
```
### Question 10: Here is a relatively clever method: (the efficiency may be relatively high, not tested!)
```
@echo off
echo Detecting data........
setlocal enabledelayedexpansion
set /a flag=0
for /l %%i in (10000,1,99999) do (
set num=%%i
rem Adding a 1 in front is to prevent special cases like 30820.
set /a num=1!num:3=!
if !num! lss 2000 if !num! gtr 200 set /a flag+=1)
echo %flag%
echo Detection completed!
pause>nul
```
Last edited by youxi01 on 2006-11-16 at 11:41 PM ]
|
|
2006-11-15 12:14 |
|