Run ID:111849

提交时间:2025-03-07 14:27:30

#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; } if(live == 1){ break; } bs++; if(bs == m){ cout << ren << " "; m = hz[ren-1]; hz[ren] = 1; bs = 0; live--; } i++; } cout << "l"; for(int i = 0;i < n;i++){ if(hz[i] != 1){ cout << hz[i]; } } return 0; }