全error有救吗
查看原帖
全error有救吗
374270
SunZLC楼主2022/10/3 13:27
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int  a[200005],n;
int main()
{
    
    scanf("%d",&n);
    int w;
    for(w=1;w<=n;w++)
        scanf("%d",&a[w]);
    while(w!=1)
    {
        for(int i=1;i<=n;i++)
        {
            if(a[i]!=-1)
            {
                printf("%d ",i);
                w--;  
                int j=i;
                while(a[j]==a[i]||(a[j]!=a[i]&&a[j]==-1))
                    j++;
                j--;
                a[i]=-1;
                i=j;
            } 
        }
        if(w!=1)
            cout<<endl;
    }
    return 0;
}
2022/10/3 13:27
加载中...