Run ID:113115

提交时间:2025-03-15 11:48:37

#include<bits/stdc++.h> using namespace std; int n, m; int r = 0,bs = 0; int live = 0; int die[1001]; int a[301]; int main() { cin >> n >> m; for(int i=1;i<=n;i++){ cin>>a[i]; } live = n+1; while(live != 1){ r++; if(r>n){ r = 1; } if(die[r]==1){ continue; } bs++; if(bs == m){ cout<< a[r] <<" "; die[r]=1; bs = 0; live--; m=a[r]; } } return 0; }