为啥错?????
查看原帖
为啥错?????
161729
ccph3000楼主2020/10/8 16:44

RT

#include<cstdio>
#include<string>
#include<algorithm>
#define R register int
#define ull unsigned long long
using namespace std;
const int base=71;
char a[1001];
ull f[10001];
inline char getch()
{
	static char buf[1<<21],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
}
inline ull init()
{
	register ull len=0,val=0;
	register char ch=getch();
	while(ch!='\n')
	{
		a[++len]=ch;
		ch=getch();
	}
	for(R i=1;i<=len;++i)val=val*base+(ull)a[i];
	return val;
}
int main()
{
	R n,cnt=1;
	scanf("%d",&n);
	for(R i=0;i<n;++i)f[i]=init();
	sort(f,f+n);
	for(R i=0;i<n-1;++i) if(f[i]!=f[i+1]) ++cnt;
	printf("%d",cnt);
	return 0;
}
2020/10/8 16:44
加载中...