7 条题解

  • 0
    @ 2025-5-28 13:38:36

    平易近人

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,m,k=0;
    	cin>>n;
    	bool a[n+1]={};
    	cin>>m;
    	int step=0;
    	bool p=0;
    	while(1)
    	{
    		for(int i=1;i<=n;i++)
    		{
    			if(a[i]==0)
    			{
    				step++;
    				if(step==m)
    				{
    					k++;
    					a[i]=1;
    					step=0;
    				}
    			}
    			if(k==n-1)
    			{
    				p=1;
    				break;
    			}
    		}
    		if(p==1)
    		{
    			break;
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		if(a[i]==0)
    		{
    			cout<<i;
    		}
    	}
    	return 0;
    }
    

    信息

    ID
    111
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    94
    已通过
    33
    上传者