#include#include #include using namespace std;struct person{ int data; int id;};int l[1001],r[1001];//存储编号为i的左边的编号和右边的编号int data[1001];//存储编号为i的耐心值int n;//总人数//初始化void init(){ cin>>n; for (int i = 1; i <= n; ++i) { cin>>data[i]; l[i] = i-1; r[i] = i+1; } //围城一个圆 l[1] = n; r[n] = 1;} //删除inline void deletePerson(int id){ r[l[id]] = r[id]; l[r[id]] = l[id];}//进行报数游戏的模拟int game(){ int rem = n;//还剩的人数 int curId = 1;//当前报数的人 bool toRight = true; //初始向右 while(rem>1){ //优化 int min = 9999999;//用来找到当前最小的耐心值 for (int i = 1; i <= n; ++i) { if(data[i]>0 and data[i]