求助
  • 板块学术版
  • 楼主_Ch1F4N_
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/7/8 23:24
  • 上次更新2023/10/27 21:25:01
查看原帖
求助
520748
_Ch1F4N_楼主2022/7/8 23:24

报错```cpp #include<bits/stdc++.h> using namespace std; struct node{ int type; int next; int last; }; node List[5001]; int main() { cin>>sum; for(int i=1;i<=sum;i++) { cin>>List[i].type; List[i].next=i+1; List[i].last=i-1; } int s=0; while(s<sum) { int nex=1;//迭代器 while(nex!=sum+1) { if(List[nex].type!=List[List[nex].next].type) { List[List[nex].last].next=List[List[nex].next]; List[List[nex].next].last=List[List[nex].last]; cout<<i<<" "; } nex=List[nex].next; } cout<<endl; }

return 0; }

2022/7/8 23:24
加载中...