1.
clear
input "N=" to n
input "M=" to m
dime A(n)
for i=1 to n
a(i)=i
endfor
k=0 &&总计数器
l=1 &&M计数器
i=1
do while k
if l=m
A(i)=0
?? i
k=k+1
l=1
else
l=l+1
endif
endif
i=iif(i
2.
clear
dime b(5,5)
b=0
k=0
for i=1 to 5
for j=1 to i
k=k+1
b(j,i)=k
endfor
if i>1
for j=i-1 to 1 step -1
k=k+1
b(i,j)=k
endfor
endif
endfor
for i=1 to 5
for j=1 to 5
?? B(i,j)
endfor
?
endfor
1、
clear
input "请输入N" to N
input "请输入M" to M
dime arr(N)
STORE 0 to arr
for i=1 to N
STORE i TO arr(i)
endfor
i=1
x=0
s=0
do while n-x>=M
IF i>n
i=1
endif
if arr(i)<>0
s=s+1
endif
if s=M
? arr(i)
arr(i)=0
x=x+1
s=0
i=i+1
loop
endif
i=i+1
enddo
2、
DIMENSION arr(25)
DIMENSION outarr(5,5)
FOR i=1 TO 25
STORE i TO arr(i)
ENDFOR
i=1
FOR a=1 TO 5
FOR b=1 TO a
outarr(b,a)=arr(i)
i=i+1
ENDFOR
FOR c=b-1 TO 1 STEP -1
IF a<>c
outarr(a,c)=arr(i)
i=i+1
ENDIF
ENDFOR
ENDFOR
FOR i=1 TO 5
FOR s=1 TO 5
?? outarr(i,s)
ENDFOR
?
ENDFOR