Run ID:111842
提交时间:2025-03-07 13:46:29
#include<bits/stdc++.h> using namespace std; int n,m; int hz[1000]; int main(){ cin >> n >> m; for(int j = 0;j < n;j++){ cin >> hz[j]; } int i = 0; int ren = 0; int bs = 0; int live = n; while(live != 0){ ren++; if(ren == n+1){ ren = 1; } if(hz[ren] == 1){ continue; } bs++; if(bs == m){ cout << hz[ren-1] << " "; m = hz[ren]; hz[ren] = 1; bs = 0; live--; } i++; } return 0; }