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

学习 时间:2026-04-06 20:36:56 阅读:6340
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

最佳回答

搞怪的草莓

迷路的金鱼

2026-04-06 20:36:56

#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;
}

最新回答共有2条回答

  • 靓丽的钢笔
    回复
    2026-04-06 20:36:56

    #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 > str;gg[str] = true;}char dw;for (int i = 0; i > 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;}

上一篇 已知关于x的方程3x+a=0的解比方程3x-a=0的解大5,则a=

下一篇 买家具去哪个网站比较好