UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213977#2380. 中位数x_add_bCompile Error//C++11523b2024-11-14 20:52:012024-11-14 23:06:40

answer

#include<bits/stdc++.h>

namespace IO
{
	template<typename Type>
	void read(Type &x){
		char ch=getchar();
		x=0;bool f=0;
		while(ch<'0'||ch>'9')
			f|=(ch=='-'),ch=getchar();
		while(ch>='0'&&ch<='9')
			x=((x<<1)+(x<<3)+(ch^48)),ch=getchar();
		x=f?-x:x;
	}
}

using namespace std;

#define LL long long
#define N 300005

int n;
int a[N];


int main()
{
	IO::read(n);
	for(int i=1;i<=n;i++)
		IO::read(a[i]);
	sort(a+1,a+n+1)
	int tot=unique(a+1,a+n+1)-a-1;
	printf("%d",a[(tot+1)/2]);
}

详细

answer.code: In function 'int main()':
answer.code:32:2: error: expected ';' before 'int'
  int tot=unique(a+1,a+n+1)-a-1;\x0d
  ^
answer.code:33:17: error: 'tot' was not declared in this scope
  printf("%d",a[(tot+1)/2]);\x0d
                 ^