还没读懂这道题什么意思?
大家举个例子说说
谢谢!
 2007-07-30 16:04
	    2007-07-30 16:04
  比如一队人围成一圈,从1~n,则从1开始报数,报到m的人出圈,然后在m的下一个人为1开始报数,直到所有人出圈,但输出为出圈人最初的序号。 理解起来简单呀
理解起来简单呀
 2007-07-30 18:13
	    2007-07-30 18:13
   2007-07-31 09:03
	    2007-07-31 09:03
  /*---------------------------------------------------------------------------
File name:      Joseph.c
Author:         HJin (email: fish_sea_bird [at] yahoo [dot] com )
Created on:     7/31/2007 11:36:07
Environment:    Windows XP Professional SP2 English +
                Visual Studio 2005 v8.0.50727.762
Modification history:
===========================================================================
Sample output:
3 5
3 1 5 2 4
5 25
5 10 15 20 25 6 12 18 24 7 14 22 4 16 1 11 23 13 3 21 19 2 9 17 8
*/
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main()
{
    int *a, M, N, i, left, s;
    while(scanf("%d%d", &M, &N)!=-1)
    {
        a = (int*)malloc(N*sizeof(int));
        if(a==NULL)
            exit(0);
        for(i=0; i<N; ++i)
            a[i] = 1;
        left = N;
        i=0;
        s=0;
        while(left>0)
        {
            if(i==N)
                i=0;
            s+=a[i];
            if(s==M)
            {
                s=0;
                --left;
                a[i]=0;
                printf("%d ", i+1);
            }
            ++i;
        }
printf("\n\n");
        free(a);
    }
    return 0;
}

 2007-08-01 02:36
	    2007-08-01 02:36
   2007-08-01 18:31
	    2007-08-01 18:31