代码求条
查看原帖
代码求条
995980
first_king楼主2023/4/29 15:36
#include <iostream>
#include <map>
using namespace std;
inline string readstr(){
	string s="";
	char ch;
	while((ch=getchar())!='\n'){
		s+=ch;
	}
	return s;
}
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			f=-1;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
} 
inline void write(int x){
	if(x<0){
		putchar('-'),x=-x;
	}
	if(x>9){
		write(x/10);
	}
	putchar(x%10+'0');
}
map<string,int> mp;
int main(){
	ios::sync_with_stdio(false);
	int n,sum=0;
	n=read();
	while(n--){
		string s;
		s=readstr();
		if(mp[s]==0){
			sum++;
			mp[s]++;
		}
	}
	write(sum);
	return 0;
}
2023/4/29 15:36
加载中...