309708: CF1722C. Word Game

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:69 Solved:0

Description

Word Game

题意翻译

$t$ 组数据,每组一个 $n$ 表示字符串数量,之后三行每行 $n$ 个长度为 $3$ 的字符串,表示三个小朋友各自的字符串。 如果一个字符串只有一个小朋友有,那他得三分。如果有两个小朋友有,两人各得一分。若三人都有,不得分。 求出三个小朋友最终得分。 By Binary_1110011_

题目描述

Three guys play a game: first, each person writes down $ n $ distinct words of length $ 3 $ . Then, they total up the number of points as follows: - if a word was written by one person — that person gets 3 points, - if a word was written by two people — each of the two gets 1 point, - if a word was written by all — nobody gets any points. In the end, how many points does each player have?

输入输出格式

输入格式


The input consists of multiple test cases. The first line contains an integer $ t $ ( $ 1 \leq t \leq 100 $ ) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $ n $ ( $ 1 \leq n \leq 1000 $ ) — the number of words written by each person. The following three lines each contain $ n $ distinct strings — the words written by each person. Each string consists of $ 3 $ lowercase English characters.

输出格式


For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $ i $ -th integer should be the number of points earned by the $ i $ -th guy.

输入输出样例

输入样例 #1

3
1
abc
def
abc
3
orz for qaq
qaq orz for
cod for ces
5
iat roc hem ica lly
bac ter iol ogi sts
bac roc lly iol iat

输出样例 #1

1 3 1 
2 2 6 
9 11 5

说明

In the first test case: - The word $ \texttt{abc} $ was written by the first and third guys — they each get $ 1 $ point. - The word $ \texttt{def} $ was written by the second guy only — he gets $ 3 $ points.

Input

题意翻译

$t$ 组数据,每组一个 $n$ 表示字符串数量,之后三行每行 $n$ 个长度为 $3$ 的字符串,表示三个小朋友各自的字符串。 如果一个字符串只有一个小朋友有,那他得三分。如果有两个小朋友有,两人各得一分。若三人都有,不得分。 求出三个小朋友最终得分。 By Binary_1110011_

Output

**题意翻译**

题目描述了一个游戏,有 $ t $ 组数据,每组数据包含三个小朋友各自的字符串。每个字符串由三个字符组成。如果一个字符串只有一个小朋友有,那他得三分。如果有两个小朋友有,两人各得一分。若三人都有,不得分。求出三个小朋友最终得分。

**题目描述**

三个人玩一个游戏:首先,每个人都写下 $ n $ 个不同的长度为 3 的单词。然后,他们按照以下规则计算分数:

- 如果一个单词只有一个人写下,那个人得 3 分,
- 如果一个单词有两个人写下,那两个人各得 1 分,
- 如果一个单词三个人都写下了,没有人得分。

最后,每个人有多少分?

**输入输出格式**

**输入格式**

输入包含多个测试用例。第一行包含一个整数 $ t $($ 1 \leq t \leq 100 $)——测试用例的数量。接下来是测试用例的描述。

每个测试用例的第一行包含一个整数 $ n $($ 1 \leq n \leq 1000 $)——每个人写下的单词数量。

接下来的三行各包含 $ n $ 个不同的字符串——每个人写下的单词。每个字符串由 3 个小写英文字母组成。

**输出格式**

对于每个测试用例,输出三个空格分隔的整数——三个人的得分。你应该按照输入的顺序输出答案;第 $ i $ 个整数应该是第 $ i $ 个人的得分。

**输入输出样例**

**输入样例 #1**

```
3
1
abc
def
abc
3
orz for qaq
qaq orz for
cod for ces
5
iat roc hem ica lly
bac ter iol ogi sts
bac roc lly iol iat
```

**输出样例 #1**

```
1 3 1
2 2 6
9 11 5
```

**说明**

在第一个测试用例中:

- 单词 `abc` 由第一个和第三个人写下——他们各得 1 分。
- 单词 `def` 只由第二个人写下——他得 3 分。**题意翻译** 题目描述了一个游戏,有 $ t $ 组数据,每组数据包含三个小朋友各自的字符串。每个字符串由三个字符组成。如果一个字符串只有一个小朋友有,那他得三分。如果有两个小朋友有,两人各得一分。若三人都有,不得分。求出三个小朋友最终得分。 **题目描述** 三个人玩一个游戏:首先,每个人都写下 $ n $ 个不同的长度为 3 的单词。然后,他们按照以下规则计算分数: - 如果一个单词只有一个人写下,那个人得 3 分, - 如果一个单词有两个人写下,那两个人各得 1 分, - 如果一个单词三个人都写下了,没有人得分。 最后,每个人有多少分? **输入输出格式** **输入格式** 输入包含多个测试用例。第一行包含一个整数 $ t $($ 1 \leq t \leq 100 $)——测试用例的数量。接下来是测试用例的描述。 每个测试用例的第一行包含一个整数 $ n $($ 1 \leq n \leq 1000 $)——每个人写下的单词数量。 接下来的三行各包含 $ n $ 个不同的字符串——每个人写下的单词。每个字符串由 3 个小写英文字母组成。 **输出格式** 对于每个测试用例,输出三个空格分隔的整数——三个人的得分。你应该按照输入的顺序输出答案;第 $ i $ 个整数应该是第 $ i $ 个人的得分。 **输入输出样例** **输入样例 #1** ``` 3 1 abc def abc 3 orz for qaq qaq orz for cod for ces 5 iat roc hem ica lly bac ter iol ogi sts bac roc lly iol iat ``` **输出样例 #1** ``` 1 3 1 2 2 6 9 11 5 ``` **说明** 在第一个测试用例中: - 单词 `abc` 由第一个和第三个人写下——他们各得 1 分。 - 单词 `def` 只由第二个人写下——他得 3 分。

加入题单

算法标签: