logo AlgoBeat OnlineJudge
登录 注册

#101695. [BZOJ 1695] [Usaco2007 Demo]Walk the Talk

内存限制:64 MiB 时间限制:5000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

Farmer John has set up a puzzle for his cows to solve. At the entrance to the barn, he has laid out an H x W (1

输入格式

  • Line 1: Two integers: H and W

  • Lines 2..H+1: Each line contains W characters, without spaces, representing a row in the grid. The first row is the top row. The first character in each row is the left-most character.

输出格式

  • Line 1: The number of cows that can enter the barn without repeating a path.

样例

样例输入

3 4
TXXO
TXQT
XTXQ

样例输出

4

OUTPUT DETAILS:

4 cows can enter the barn, each one spelling out one of the 'TO's.