c语言代码优化o1的结果,帮忙看一下如何优化代码

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

Description:I think most of you are using system named of xp or vista or win7.And these system is consist of a famous game what is mine sweeping.You must have played it before.If you not,just look the game rules followed.

There are N*N grids on the map which contains some mines , and if you touch that ,you lose the game.If a position not containing a mine is touched, an integer K (0 < =K <= 8) appears indicating that there are K mines in the eight adjacent positions. If K = 0, the eight adjacent positions will be touched automatically, new numbers will appear and this process is repeated until no new number is 0. Your task is to mark the mines' positions without touching them.

Now, given the distribution of the mines, output the numbers appearing after the player's first touch.Input:The first line of each case is two numbers N (1 <= N <= 100) .Then there will be a map contain N*N grids.The map is just contain O and X.'X' stands for a mine, 'O' stand for it is safe with nothing. You can assume there is at most one mine in one position. The last line of each case is two numbers X and Y(0<=X

If the player doesn't touch the mine, output the numbers appearing after the touch. If a position is touched by the player or by the computer automatically, output the number. If a position is not touched, output a dot '.'.

Output a blank line after each test case.Sample Input:5

OOOOO

OXXXO

OOOOO

OXXXO

OOOOO

1 1

5

OOOOO

OXXXO

OOOOO

OXXXO

OOOOO

0 0Sample Output:it is a beiju!

1....

.....

.....

.....

.....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值