Run ID:147
提交时间:2022-07-21 09:32:24
#include<stdio.h> #include<iostream> using namespace std; int main(){ int n,m; cin>>n>>m; int a[101]={0}; int cnt=0;//统计共杀了多少人 int i=0;//数到M杀死该人 int pos=0; while(cnt<n-1) { pos++; if(a[pos]!=1) i++; if(i==m) { a[pos]=1; cout<<pos<<" "; i=0; cnt++; } if(pos>=n) { pos=0; } } return 0; }