CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » DreamSpark 2010 » MineSweeper

MineSweeper

Problem code: DPC103

  • All Submissions

Have you ever played Minesweeper? It s a cute little game which comes within a certain Operating System which name we can t really remember. Well, the goal of the game is to find where are all the mines within a MxN field. To help you, the game shows a number in a square which tells you how many mines there are adjacent to that square. For instance, suppose the following 4x4 field with 2 mines (which are represented by an * character):

*

.

.*..

.

 

If we would represent the same field placing the hint numbers described above, we would end up with:

*100

2210

1*10

1110

 

As you may have already notice, each square may have at most 8 adjacent squares.

 

Input:

The input will consist of an arbitrary number of fields. The first line of each field contains two integers n and m (0<n, m<=100) which stands for the number of lines and columns of the field. Each safe square is represented by an . Character (without the quotes) and each mine is represented by an * character (without the quotes). The first field line where n=m=0 represents the end of input and should not be processed.

 

Output:

For each field, you must print the following message in a line alone:

Field #x:

Where x stands for the number of the field (starting from 1). The next n lines should contain the field with the . Characters replaced by the number of adjacent mines to that square. There must be an empty line between field outputs.

 

Sample Input

4 4

*

.

.*..

.

0 0

 

Sample Output

Field #1:

*100

2210

1*10

1110


Author: rushikesh30
Date Added: 25-02-2010
Time Limit: 10 sec
Source Limit: 50000 Bytes
Languages: C, C99 strict, CLOJ, CPP 4.0.0-8, CPP 4.3.2, CS2, F#, GO, JAVA, JS, PERL6, PYTH 3.1.2, TEXT


  • Submit

Comments

  • Login or Register to post a comment.

where should i register for

vish @ 27 Feb 2010 07:29 PM

where should i register for this contest ??????????//

I am the Organizer. This

MSP_bitmesra @ 27 Feb 2010 07:50 PM

I am the Organizer.

This contest is a part of Tech-Days2010 and Microsoft DreamSpark Yatra organized by Microsoft Student Partner India Team and supported by Microsoft Academia Team.

Our UnderConstruction WebSite is at www.tech-days2010.com

and to register visit http://bit.ly/RegisterDevCon

Moreover when you are

MSP_bitmesra @ 27 Feb 2010 07:53 PM

Moreover when you are registering at http://bit.ly/RegisterDevCon , you need not pay if you are attending only online Events. But registration is compulsory to get prizes and Certis.

is the input in the above

gaurav17 @ 27 Feb 2010 08:53 PM

is the input in the above example correct?

isn't should be

*...

....

.*..

....

yes the input should be what

kunaljain @ 27 Feb 2010 10:19 PM

yes the input should be what you wrote..Assume that its there in the test data..

is there a space btn Field n

ankit_ankit @ 27 Feb 2010 10:58 PM

is there a space btn Field n #

and should there b a space after every Field # output

I am very well aware that

bhanuvrat @ 28 Feb 2010 01:48 AM

I am very well aware that this kind of requests are not entertained but since I am getting "wrong answer" can I have a few more testcases to test where my code is going worng?

Special Thanks to Rushikesh

MSP_bitmesra @ 28 Feb 2010 11:54 AM

Special Thanks to

Rushikesh Deshpande (ISMU Dhanbad);  Shahzor Khan(BIT Mesra); Kunal Jain(IIIT Hyderabad); Gourab Mitra(MSP BIT Mesra); Subhradip Saha(MSTC BIT Mesra)

@ankit_ankit I really

MSP_bitmesra @ 28 Feb 2010 02:56 PM

@ankit_ankit I really appreciate your dedication. Keep trying until you succeed! :)

@vishal thanx

ankit_ankit @ 28 Feb 2010 03:40 PM

@vishal

thanx

@Kunal You are the first one

MSP_bitmesra @ 28 Feb 2010 04:35 PM

@Kunal You are the first one to solve all 7 questions.

@Dan Congrats to you too!

@ALL Please mail your

MSP_bitmesra @ 28 Feb 2010 09:19 PM

@ALL

Please mail your CodeChef ID, your name, your Institutions Name, Your Address(Where you want Posters, Certis, Goodies to be delivered, (No. of deliveries will depend on our budget)) to dreamsparkyatra@gmail.com For Updates follow http://twitter.com/dreamsparkyatra .

Happy Holi and Happy Coding!

@ALL Please mail your

MSP_bitmesra @ 28 Feb 2010 09:19 PM

@ALL

Please mail your CodeChef ID, your name, your Institutions Name, Your Address(Where you want Posters, Certis, Goodies to be delivered, (No. of deliveries will depend on our budget)) to dreamsparkyatra@gmail.com For Updates follow http://twitter.com/dreamsparkyatra .

Happy Holi and Happy Coding!

@All You can mail after the

MSP_bitmesra @ 28 Feb 2010 09:45 PM

@All

You can mail after the CONTEST!

@All Check out the DreamSpark

MSP_bitmesra @ 28 Feb 2010 11:44 PM

@All

Check out the DreamSpark Professional Programming Contest #2 on 13th March 18:00 hours IST. We will send Posters to Participants by Post to promote the Contest Series. We'll also Send Participation E-Certis.

i need  asource for this code

chakib12 @ 14 Oct 2010 08:21 PM

i need  asource for this code minesweeper

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com