求解答红字部分怎么理解
#include <stdio.h>#define N 100
#define S 1
#define M 10
int p[100], n, s, m;
void WriteDat(void);
void Josegh(void)
{
int i, j, s1, w;
s1 = s;
for (i=1; i<=n; i++)
p[i-1] = i;
for (i=n; i>=2; i--)
{
s1 = (s1+m-1)%i;
if (s1 == 0)
s1 = i;
w = p[s1-1];
for (j=s1; j<=i-1; j++)
p[j-1] = p[j];
p[i-1] = w;
}
}
void main()
{
m = M;
n = N;
s = S;
Josegh();
WriteDat();
}
void WriteDat(void)
{
int i;
FILE *fp;
fp = fopen("out.dat", "w");
for (i=N-1; i>=0; i--)
{
printf("%4d ", p[i]);
fprintf(fp, "%4d", p[i]);
if (i%10 == 0)
{
printf("\n");
fprintf(fp, "\n");
}
}
fclose(fp);
}