作业帮 > 英语 > 作业

acm 竞赛题xiaoA is a beautiful girl,and she has so many skirts

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/09/30 09:50:42
acm 竞赛题
xiaoA is a beautiful girl,and she has so many skirts that she won't wear a skirt a second time before the skirt is washed.Now xiaoA wants to go shopping,
how many skirts she can choose to wear.
In order to distinguish these skirts,she gives out every skirt with a unique name.
Input
The first line of input contains a positive integer T (T
#include
#include
#include
#include
using namespace std;
map gg;
int cases;
int main ()
{
scanf ("%d\n",&cases);
while (cases--)
{
int n,m;
gg.clear ();
scanf ("%d %d\n",&n,&m);
char str[20];
for (int i = 0; i < n; i++)
{
cin >> str;
gg[str] = true;
}
char dw;
for (int i = 0; i < m; i++)
{
cin >> dw >> str;
if (dw == 'D') gg[str] = false;
else if (dw = 'W' ) gg[str] = true;
}
map ::iterator iter;
int count = 0;
for (iter = gg.begin (); iter != gg.end();iter++)
{
if (iter->second)
count ++;
}
printf ("%d\n",count);
}
return 0;
}