China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 23:33
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Discussion][Exploration] Using batch processing to make interesting math problems DigestI View 36,418 Replies 139
Floor 91 Posted 2006-11-25 22:28 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
It will be calculated out, but not in one place. The form it gives is like this:
1×54=54
2×27=54
.......
2×27=54
3×18=54
……
3×18=54
6×9=54
Floor 92 Posted 2006-11-25 22:37 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 93 Posted 2006-11-27 15:09 ·  中国 河南 郑州 荥阳市 联通
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
#25 ?
Number of chickens and dogs =
There are seventy-nine chickens and dogs, with two hundred feet on the ground. Think and calculate, how many chickens? How many dogs?

@echo off
set /a 鸡狗=79
set /a 鸡腿狗腿=200
set /a 最大狗=200/4
setlocal enabledelayedexpansion
for /l %%i in (1 1 %最大狗%) do (
set /a 狗腿=%%i*4
set /a 鸡腿=%鸡腿狗腿%-!狗腿!
set /a 鸡=!鸡腿!/2
set /a num=%%i+!鸡!
call :test !num! %%i !鸡! %鸡狗%
)

pause>nul

:test
if %1 EQU %4 echo 可能的组合为:狗=%2 鸡=%3
goto :eof
Floor 94 Posted 2006-12-28 14:32 ·  中国 陕西 西安 电信
初级用户
Credits 46
Posts 21
Joined 2006-12-25 14:28
19-year member
UID 74536
Gender Male
From 西安
Status Offline
Collecting it
Floor 95 Posted 2007-01-29 08:12 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
A good post should be topped up~:)


The way to top up a long-sunken good post without posting too much junk posts is: delete your original reply in the post (-1 point), and then reply again~:)


[ Last edited by redtek on 2007-1-28 at 07:14 PM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 96 Posted 2007-01-29 10:57 ·  中国 北京 联通
中级用户
★★
带走
Credits 435
Posts 88
Joined 2005-09-24 19:22
20-year member
UID 42793
Status Offline
Posting up also has such knowledge, learned.
Floor 97 Posted 2007-02-01 02:50 ·  中国 湖南 长沙 联通
社区乞丐
★★
gaoshou
Credits -16
Posts 77
Joined 2007-01-30 09:11
19-year member
UID 78105
Gender Male
Status Offline
No speed
:cool:
Floor 98 Posted 2007-03-04 17:13 ·  新西兰
初级用户
Credits 107
Posts 47
Joined 2007-03-03 03:12
19-year member
UID 80618
Gender Male
Status Offline
All are experts, drifting by```
Floor 99 Posted 2007-03-17 11:09 ·  中国 湖北 黄冈 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
So the original maximum number is 2^31 - 1. No wonder 2^31 overflows!
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 100 Posted 2007-03-17 11:42 ·  中国 湖北 黄冈 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
It would be nice if we could filter the multiples of 3, 4, 5 and 5, 12, 13.
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 101 Posted 2007-03-17 12:39 ·  中国 湖北 黄冈 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
The code on floor 84 is pretty good, and the running efficiency is very high.
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 102 Posted 2007-03-19 11:59 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
@echo off
rem x+y=n m*x+y/m=n
set n=100
set m=4
set x=100/(1+m)
set y=x*m
echo Number of senior monks is %x%
echo Number of senior monks is %y%
pause>nul
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 103 Posted 2007-03-19 12:08 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
There are several errors. The fifth line should change "100" to "n". The eighth line should change "大" to "small". This correction is hereby made. Please forgive me a lot.
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 104 Posted 2007-03-19 12:39 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
### Step 1: Analyze the conditions
We can find that if we add 1 person to the number of people participating in the sports meeting, then the number of people can be exactly divided by 2, 3, 4, 5, and 6.

### Step 2: Find the least common multiple of 2, 3, 4, 5, and 6
- Prime factorize each number:
- \(2 = 2\)
- \(3 = 3\)
- \(4 = 2\times2\)
- \(5 = 5\)
- \(6 = 2\times3\)
- The least common multiple is the product of the highest powers of all prime factors involved. So the least common multiple of 2, 3, 4, 5, and 6 is \(2\times2\times3\times5= 60\)

### Step 3: Find the number of people participating in the sports meeting
Since adding 1 person makes it divisible by 60, then the number of people participating in the sports meeting is \(60 - 1 = 59\)

So the school has at least 59 people participating in this sports meeting.
The translated text is:### Step 1: Analyze the conditions
We can find that if we add 1 person to the number of people participating in the sports meeting, then the number of people can be exactly divided by 2, 3, 4, 5, and 6.

### Step 2: Find the least common multiple of 2, 3, 4, 5, and 6
- Prime factorize each number:
- \(2 = 2\)
- \(3 = 3\)
- \(4 = 2\times2\)
- \(5 = 5\)
- \(6 = 2\times3\)
- The least common multiple is the product of the highest powers of all prime factors involved. So the least common multiple of 2, 3, 4, 5, and 6 is \(2\times2\times3\times5 = 60\)

### Step 3: Find the number of people participating in the sports meeting
Since adding 1 person makes it divisible by 60, then the number of people participating in the sports meeting is \(60 - 1 = 59\)

So the school has at least 59 people participating in this sports meeting.
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 105 Posted 2007-03-19 12:57 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
Through mathematical knowledge, it is known that when this number is increased by 1, it is a multiple of 2, 3, 4, 5, 6.
Thus, the following code is available:

@echo off
setlocal enabledelayedexpansion
for /l %%i in (1 1 10000) do (
title Detecting %%i
set/a temp=%%i+1
set/a flag=0
for %%a in (2 3 4 5 6) do (
set /a tmp=!temp! %% %%a
if !tmp! EQU 0 set/a flag+=1)
if !flag! GEQ 5 echo The number is: %%i & goto :exit)
:exit
pause>nul
Forum Jump: