A15308 | Word Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
- 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.
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.
- 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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted