10分 答案全零
查看原帖
10分 答案全零
700986
IkunFriendsChat楼主2022/10/18 13:29

rt。

#include<bits/stdc++.h>
using namespace std;
map<string,bool>gd;
int n,i,value=0,j,cnt=0;
string l="",str[1005];
char c;
int main()
{
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>l;
		for(j=0;j<l.size();j++)
		if(l[j]>='A'&&l[j]<='Z')l[j]=l[j]-'A'+'a';
		gd[l]=1;
	}
	getchar();
	while(scanf("%c",&c)!=EOF)
	{
		l="";
		if(c>='a'&&c<='z')l+=c;
		else if(c>='A'&&c<='Z')l+=(c-'A'+'a');
		else
		{
			//cout<<l<<endl;
			if(gd[l]==1)
			{
				value++;
				cnt++;
				str[cnt]=l;	
			}
			gd[l]=0;
			l="";
		}
		if(c=='.')
		for(j=1;j<=cnt;j++)
		{
			gd[str[j]]=1;
			str[j]="";
		}
	}
	cout<<value<<endl;
	return 0;
}

jojo孩子吧

2022/10/18 13:29
加载中...