10189-minesweeper
Time limit:3.000 seconds
Http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8category=24page=show_problem problem=1130
The Problem
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. So, the goal of the game is to find where are all the mines within a MxN field. To help you, the
What do you do when you're not sure what commands you're running, especially complex commands that use a lot of options? In this case, we use the man pages to get help. There are other options that may include commands suchas ' help ', 'whereis' and 'whatis'. But all of these have both advantages and disadvantages. When we browse the man pages to see the options and help, the description is too lengthy and we can't understand it in a short time. Linux Mans Pages Likewise, the' help ' command ma
Reprinted from: http://blog.csdn.net/haoel/archive/2009/10/28/4737425.aspxOriginal link: http://coolshell.cn /? P = 1561 (cool shell)
Do you often forget some function names or attribute names in CSS? At that time, you must think that if you have a cheat sheet at hand, you can do that. Of course, this "cheat sheet" is not for you to cheat, and this "NOTE" is to l
This is titled Sichuan Province election.In fact, we found that as long as the first two lattice of thunder, the rest can be handed out.So enumerate the first two (one? ) Check the state of the lattice and then determine if the last (n+1) lattice meets the requirements (=0).Better to think about it .... Note that changing the upper bound of the Loop to Min (1,a[1]) is still possible.#include #include #include #include #define MAXN 10005using namespace Std;int n,a[maxn],f[maxn],ans=0;void work ()
Test instructions , a column of unknown area length is n (≤1000), gives the number of the second column, to find out how many kinds of ray in the region.
Solution:Search. The problem seems to be a large 1000 range, and in fact, with reasonable pruning, the number of States becomes very, very little.A ray can affect up to 3 lattices, directly from the top down to the point where there is no thunder. There is a ray of thunder that gives the number of the affected lattice minus one.A negativ
Straight forward method. I did not work out a funnier solution.
Code:
/*************************************** **********************************
* Copyright (c) 2008 by liukaipeng *
* Liukaipeng at gmail dot com *
**************************************** *********************************/
/* @ Judge_id 00000 10189 C "minesweeper "*/
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Deprecision Max 102
GDI + provides the solidbrush, texturebrush, hatchbrush, lineargradientbrush, and pathgradientbrush classes. You can use the static attributes in systembrushes and brushes to obtain a pre-defined brush table, which saves the trouble of dispose.
The pen is used to draw a line. The line of the GDI + has a width and an internal area. Therefore, the pen in the GDI + needs a brush instance to construct it. Likewise, systempens and pens provide predefined monochrome pen instances.
In addition, the fo
of drawline:Drawline (pen, point, point)
Drawline (pen, pointf, pointf)
Drawline (pen, int32, int32, int32, int32)
Drawline (pen, single, Single)
We can use two points or four coordinates to create a line segment. But why are there two overloads of int and float? This is related to the unit, scale, and transform in GDI +. The floating point coordinate has its own meaning. The next article will introduce the coordinate system and unit of GDI +.
Graphics also provides a drawlines function that sp
be.Analyze the functions that are required to complete each actionLeft-click:First infer the position that is pressed, only the button bitmap above and the egg above the left click is valid.Let's say you click on the button bitmap. Change the picture of the button bitmap (when the left button is released and then initialized again)Suppose you click on the egg bitmap, and if there is no bone in the egg, the corresponding number is displayed. and redraw the surrounding 8 positions. When there is
Today is the function of the game process, the basic algorithm has been explained before, today is to achieve basic functions Add the header files you need to use earlier#include The process of the game is the mouse operation process, the realization is the mouse click Processing, because not WINAPI button click, so you have to calculate the coordinates to get the mouse actionvoid Mousegetxy (void) {m = Getmousemsg (); MouseX = m.x; Mousey = m.y;}M is the structure of the mouse, preceded by a de
has been disposed of, no judgment will be made on the lattice */return;minenum--;/* shows a number or a space in the lattice is to deal with a lattice, when all the lattice has been processed to indicate Victory */if (Mine I [J].roundnum = = 0 mine[i][j].num! = 1)/* Show Spaces */{drawempty (i, J, 1, White); Mine[i][j].num = 0;} ElseIf (Mine[i][j].roundnum! = 0)/* Output Thunder number */{drawempty (i, J, 1, White); _stprintf_s (Randminenum, _t ("%d"), Mine[i][j]. Roundnum); SetColor (RED); Ou
the upper-left lower-right corner coordinate of the ellipse bounding rectangle Setfillstyle (bs_solid); Setfillcolor (BLACK);//Draw the eye fillellipse (x, x, y, n); FillEllipse (103, 13, 107 Bar (97, 20, 103, 21);//Draw Mouth}These are basic drawing functions, is to understand C better, although not as MFC's encapsulation, but can understand the basic principle of WINAPI is similarAfter the interface is painted well, this function is simple, using random number function to create a mine, thund
This example describes the JavaScript minesweeper game. Share to everyone for your reference, specific as follows:
Turn out the game posted at the beginning of the year, mine clearance I believe that we have played, the first figure:
Source:
Full instance code click here to download the site .
More readers interested in JavaScript-related content can view this site: "JavaScript data structure and algorithm skills summary", "JavaScript Ma
Release the source code today, due to write in a file very messy, so divided into three files written Drawing and mouse functions graph.h/* Drawing with mouse-related functions */#include Auxiliary calculation function Auxiliary.h/* Auxiliary function */#include Main function Main.cpp#include More features are being perfected, to be continued!!C language new handwritten minesweeper source code
mouse, point Mouse define mousex = mouse.x; Mousey = mouse.y;if (MouseX > mousexThen in Gamebegin () Add the operation about the mouse, and randomly generate the number of mines, the following is the complete codevoid Gamebegin (void) {int i, j;cleardevice (), if (PLAY! = 1) {setcursorpos (100, 10),//Set mouse initial position mousex = 100; Mousey = 10;} PLAY = 1;minenum = 0;setfillstyle (Solid_fill);//Here the usage and TC differ setfillcolor (white); bar (0, 0, 200, 230); Set the background
Use the cheat tool in Linux to learn how to use system commands
Cheat is a tool that is very suitable for Linux system administrators. It helps you quickly and easily get familiar with the use of system commands in Linux, such:
Cheat installation is simple:
Cheat has two dependent tools: python and pip. Therefore, you
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.