编程介的小学生 2017-09-04 14:15 采纳率: 20.5%
浏览 1131
已采纳

Rocket Mania Plus

Rocket Mania is one of my favourite games of Fantasy Games series. In the game, there are matches on the left hand side, and rockets on the right hand side. In between, there are different sorts of fuse blocks (See Figure A). These fuses can be rotated 0, 90, 180 or 270 degrees. To launch a rocket, you must form an unbroken path of fuses from the match to the rocket. When a fuse is complete, all rockets linked to a match will launch (See Figure B).

Your task is, given an initial situation, rotate some fuse blocks to make as many rockets launch as possible by firing one or more matches.

Figure A Figure B Fuse Pipes
Input

Input contains multiple test cases. Each test case consists of 9 lines, each line consists of 6 characters. The characters may be '.', '-', 'L', 'T' or '+', which specify an empty block or a corresponding type of fuse block. Every test case will be followed by a blank line.

Output

There is one line for each test case, which is the maximum number of rockets you can make launch. If no rockets can launch, just output 0.

Sample Input

LLLLLL
LLLLLL
LLLLLL
LLLLLL
LLLLLL
LLLLLL
LLLLLL
LLLLLL
LLLLLL

......
.L----
-+----
.-....
.T---L
.L----
......
......
......

-L-L-L
-TL--T
-L-T-L
--+---
---T--
-TL---
---LT-
---T-T
-TL-T-

TTTTTT
TTTTTT
TTTTTT
TTTTTT
TTTTTT
TTTTTT
TTTTTT
TTTTTT
TTTTTT

Sample Output

4
3
6
9

  • 写回答

1条回答

  • threenewbee 2017-09-18 21:26
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题