1 条题解

  • 0
    @ 2025-9-9 23:54:51

    C++ :

    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    using namespace std;
    int main()
    {
    	int M,N,t=0,x=0;
    	scanf("%d%d",&M,&N);
    	int a[M+10];
    	memset(a,0,sizeof(a));
    	while(x!=M-1)
    	{
    		for(int b=1;b<=M;++b)
    		{
    			if(a[b]==0)
    			{
    				++t;
    			
    			}
    			if(t==N)
    			{
    				t=0;
    				a[b]=1;
    				++x;
    				N=b;
    			}
    		}
    	}
    	for(int c=1;c<=M;++c)
    	{
    		if(a[c]==0)
    		{
    			printf("%d",c);
    		}
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1890
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者