CF1722C.Word Game
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
三人进行一场比赛:首先,每人写下 n 个互不相同的、长度为 3 的单词。然后,按如下规则统计总分:
- 若某个单词仅由一人写出,则该人得 3 分;
- 若某个单词由两人写出,则这两人各得 1 分;
- 若某个单词由三人全部写出,则无人得分。
最终,每位玩家各得多少分?
输入格式
The input consists of multiple test cases. The first line contains an integer t (1≤t≤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≤n≤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.
输入包含多个测试用例。第一行包含一个整数 t(1≤t≤100),表示测试用例的数量。随后是各测试用例的描述。
每个测试用例的第一行包含一个整数 n(1≤n≤1000),表示每人所写的单词数量。
接下来的三行,每行包含 n 个互不相同的字符串,分别表示三人所写的单词。每个字符串均由 3 个小写英文字母组成。
输出格式
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.
对于每个测试用例,输出三个以空格分隔的整数——即三位选手各自获得的分数。你需要按照输入的相同顺序输出答案;第 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
说明/提示
In the first test case:
- The word abc was written by the first and third guys — they each get 1 point.
- The word def was written by the second guy only — he gets 3 points.
在第一个测试用例中:
- 单词 abc 由第一位和第三位参与者写出——他们每人获得 1 分。
- 单词 def 仅由第二位参与者写出——他获得 3 分。
输入解题思路,AI测评打分。不知道怎么写?