CF1932A.Thorns and Coins
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
During your journey through computer universes, you stumbled upon a very interesting world. It is a path with n consecutive cells, each of which can either be empty, contain thorns, or a coin. In one move, you can move one or two cells along the path, provided that the destination cell does not contain thorns (and belongs to the path). If you move to the cell with a coin, you pick it up.
Here, green arrows correspond to legal moves, and the red arrow corresponds to an illegal move.You want to collect as many coins as possible. Find the maximum number of coins you can collect in the discovered world if you start in the leftmost cell of the path.
输入格式
The first line of input contains a single integer t ( 1≤t≤1000 ) — the number of test cases. Then the descriptions of the test cases follow.
The first line of each test case contains a single integer n ( 1≤n≤50 ) — the length of the path.
The second line of each test case contains a string of n characters, the description of the path. The character '.' denotes an empty cell, '@' denotes a cell with a coin, and '*' denotes a cell with thorns. It is guaranteed that the first cell is empty.
输出格式
For each test case, output a single integer, the maximum number of coins you can collect.
输入输出样例
输入#1
3 10 .@@*@.**@@ 5 .@@@@ 15 .@@..@***..@@@*
输出#1
3 4 3
说明/提示
The picture for the first example is in the problem statement.
Here is the picture for the second example:
And here is the picture for the third example: