编程介的小学生 2017-07-30 14:01 采纳率: 20.5%
浏览 695
已采纳

How Many People Can Survive

Problem Description
Two opposing armies are lost in a big forest. The forest is dangerous ,because it is filled with poisonous gas . People can only survive by staying at the place that is surrounded by trees.As the two armies are opposing, if one army are able to move to the other one , they wil fight with each other. Only the army that with the more people will survive, if the number is equal, no one will survive. Now you are asked to find out how many people will survive.

Input
There are several test cases.
Each case begins with an integer n and m (3<=n,m<=300) stands for the size of forest.
Then follows n lines , each line contains m characters .
‘.’ Stands for empty place
‘#’Stands for tree and can’t been walked through
‘o’Stands for the first army
‘v’stands for the second army

Output
The output contains one line for each data set : two integers, p and q, stands for the number of the first army that can survive and the number of the second army that can survive.

Sample Input
3 3
..#
ovo

10 10
...vvvoo..
##########
#....oo.o#
#..v.v...#
#........#
#..####..#
#..#o.#..#
#..#.v#..#
#..####..#
##########

Sample Output
0 0
3 0

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-07-31 15:36
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试