UCRPC F21 A - Senseless Census

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 256M

Problem type

Count all the Toads!

Look through the train car and count the Toads you see!

Senseless Census is a four-player mini-game in Super Mario Party and you can view how the game is actually played here. Each of the four players must count the number of toads on the entire train. The one who counts the most precisely wins the game.

The difficulty of the game is that you can only see a segment of the train car on your screen at a time so you must walk around to see the entire train. At the same time, many of the Toads are annoyingly walking around back and forth. However, we can make this task easier if we can take a snapshot of the train car at different points at the same time. Given a snapshot of the train car, your task is to write a program to count the exact number of Toads.

Input Specification

The first line of the input contains two integers, n and m (0\le n, m\le 10^3), which means that the train car can be described as a n\times m matrix.

The next n lines each contain m characters, which are either -, t or s. They describe the snapshot of the train car. - means there's nothing, t means there's a Toad, and s means there's an empty seat or table.

Output Specification

The output only contains 1 integer, which is the number of Toads in the train car.

Sample Input

5 6

Sample Output


Explanation for Sample Output

Source of pictures and descriptions: https://www.mariowiki.com/Senseless_Census. You can also find more details about the game from this site.


There are 20 test cases, 3 points each.


There are no comments at the moment.