"Daily Study" and "Deep Search" codevs2452 minesweeper

Source: Internet
Author: User

Source: 05 Sichuan provincial election

Reprint please specify source [ametake All rights reserved]http://blog.csdn.net/ametake Welcome to see

Title Description Description

I believe everyone has played the game of minesweeper. There are some thunder in a n*m matrix, you need to find out the ray based on some information. Halloween arrived, "Yu" People have a simple game of minesweeper, the rules of the game and the same as mine, if a lattice does not have thunder, then it is the number of the inside of the grid and its 8 connected to the number of thunder. Now the chessboard is NX2, in the first column some grids are thunder, and the second column has no thunder,

Since the first column of thunder may have multiple scenarios that meet the limits of the number of the second column, your task is to determine how many of the first quagliere are placed according to the information in the second column.

Enter a description input Description

The first behavior n, the second row has n number, in order the number of the second column in the lattice. (1<= N <= 10000)

outputs description output Description

A number, that is, the number of thunder in the first column.

sample input to sample

2

1 1

Sample output Sample outputs

2

Pictures can be found online, the number in the grid can be 0, does not affect the problem

It is said that there are deep searches on the internet, moving back, and simulating. I'm here for a deep search.

The idea is a deep search of the classic ideas, for each of the grid fill or not fill for searching, and then eliminate the impact.

Code:



--gradually frost wind miserable, off the river snub, setting sun when building.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Daily Study" and "Deep Search" codevs2452 minesweeper

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.