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 give
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 03:13:46
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 give
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
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 give
#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;
}