求助各位大佬
  • 板块灌水区
  • 楼主histcat
  • 当前回复3
  • 已保存回复3
  • 发布时间2021/10/26 11:29
  • 上次更新2023/11/4 02:14:21
查看原帖
求助各位大佬
361592
histcat楼主2021/10/26 11:29
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<ctype.h>

using namespace std;



long long n = 0;
int a[20000000] = {-100};
long long kuai_first_weizhi[20000000];
int num = 0;

int check()
{
	for(int i = 1;i <= n;i++)
	{
		if(a[i] != -1)
		{
			return 1;
		}
	}
	return -1;
}

int aaa()
{
	for(int i = 1;i <= n;i++)
	{
		if(a[i] != -1)
		{
			return i - 1;
		}
	}
}

int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%lld",&n);
	for(int i = 1;i <= n;i++)
	{
		scanf("%d",&a[i]);
	}
	//找块,删块 

	while(check() == 1)
	{
		int temp = a[aaa()];
		for(long long i = 1;i <= n;i++)
		{
			if(a[i] != -1)
			{
				if(temp != a[i])
				{
					temp = a[i];
					kuai_first_weizhi[++num] = i;
					printf("%lld ",i);
					a[i] = -1;
				}
			}
		} 
		printf("\n");
	}

	fclose(stdin);
	fclose(stdout);
	return 0;
 } 

aaa函数for循环外没写返回值,hydro和luogu CE了,有道小图灵和计算客没编译错误,不知道ccf咋判断,有大佬知道吗,谢谢!

2021/10/26 11:29
加载中...