Clear
*!*
1, 100到1000之间前十个质数
j = 1
For Number=100 To 1000
compteur=0
For i=Number To 1 Step -1
If Mod(Number,i)=0
compteur=compteur+1
Endif
Endfor
If compteur=2 And j <= 10
? j, Transform(Number) + " 是质数"
*!*
? Iif(j=10, Transform(Number) + " 是质数", "")
j = j + 1
Endif
Endfor
?
?
?
*!*
2, 把一张1元纸币换成1分,2分,5分硬币,每种至少一枚,问兑换后硬币枚数最多与最少的枚数之差是多少
Local i,j,k, i1, j1, k1, l
Store 0 To i,j,k, i1, j1, k1, l
? "
一分(枚):二分(枚):五分(枚):相差(枚):"
For i=1 To 100
For j=1 To 50
For k=1 To 20
If i+2*j+5*k==100 And i+j+k>20
If Max(Abs(i-j), Abs(i-k), Abs(j-k)) > l
l = Max(Abs(i-j), Abs(i-k), Abs(j-k))
i1 = i
j1 = j
k1 = k
Endif
Endif
Endfor
Endfor
Endfor
? i1, j1, k1, l
Return
团队红星二锅头,队长王猛,领队李冲,顾问杨伟,副队张挺,外联马彪,内勤韩秀,人事顾闯,财务赵魁,后勤周强