We are going to cover a wall (whose area is r*c) with m different kinds of oil paint ( that is also m kinds of colors ). In order to simplify the problem, we will regard the wall as a set of r*c small squares. The area of one small square is 1 and a small square could be expressed as (x , y) (1<=c).
So every time when we are painting some selected area, we are covering the small squares in that area with a particular color.
Your task is to calculate the number of colors which are completely covered after m times of painting.
For example, given a rectangular area of a upper left corner (x1, y1) and a lower right corner (x2, y2)
Multiple test cases, end with EOF.
In every test case:
In the first line, there will be 3 integers: r c m. r and c are the length and width of the wall , and m is the number of colors of the oil paint. Each type of the oil paints has its own different color.
Then there will be m lines followed, and the ith line has 4 integers: x1 y1 x2 y2, which means that we will cover the rectangular area of a upper left corner (x1, y1) and a lower right corner (x2, y2) with the ith color.
One number, how many colors are completely covered after all the m rectangular areas are painted .
3 3 3
1 1 2 2
1 3 3 3
1 1 3 3
In mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous regions, producing a figure called a map, no more than four colors are required to color the regions of the map so that no two adjacent regions have the same color.
— Wikipedia, the free encyclopedia
In this problem, you have to solve the 4-color problem. Hey, I’m just joking.
You are asked to solve a similar problem:
Color an N × M chessboard with K colors numbered from 1 to K such that no two adjacent cells have the same color (two cells are adjacent if they share an edge). The i-th color should be used in exactly ci cells.
Matt hopes you can tell him a possible coloring.
The first line contains only one integer T (1 ≤ T ≤ 5000), which indicates the number of test cases.
For each test case, the first line contains three integers: N, M, K (0 < N, M ≤ 5, 0 < K ≤ N × M ).
The second line contains K integers ci (ci > 0), denoting the number of cells where the i-th color should be used.
It’s guaranteed that c1 + c2 + · · · + cK = N × M .
For each test case, the first line contains “Case #x:”, where x is the case number (starting from 1).
In the second line, output “NO” if there is no coloring satisfying the requirements. Otherwise, output “YES” in one line. Each of the following N lines contains M numbers seperated by single whitespace, denoting the color of the cells.
If there are multiple solutions, output any of them.
1 5 2
3 3 4
1 2 2 4
2 3 3
2 2 2
3 2 3
2 2 2
4 3 4
2 1 2
4 3 4
1 2 3
2 3 1
We divide the HZNU Campus into N*M grids. As you can see from the picture below, the green grids represent the buidings. Given the size of the HZNU Campus, and the color of each grid, you should count how many green grids in the N*M grids.
Standard input will contain multiple test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
The first line of each test case contains two integers n and m(1<=100), the size of the campus. Then follow n lines, each line containing m integers. The j-th integer in the i-th line is the color of that grid, 0 stands for white color, while 1 stands for green.
Results should be directed to standard output. For each case, output an integers T, the total green grids in the N*M size campus.
1 0 1
0 0 1
1 1 0
using namespace std;
const int MAX_i = 10000+1;
int V, E;//V表示顶点数，E表示边的数量
首先跟大家说明一点，我们做 IT 类的外包开发，是非标品开发，所以很有可能在开发过程中会有这样那样的需求修改，而这种需求修改很容易造成扯皮，进而影响到费用支付，甚至出现做完了项目收不到钱的情况。
从 PC 时代至今，众人只知在 CPU、GPU、XPU、制程、工艺等战场中，英特尔在与同行硬件芯片制造商们的竞争中杀出重围，且在不断的成长进化中，成为全球知名的半导体公司。殊不知，在「刚硬」的背后，英特尔「柔性」的软件早已经做到了全方位的支持与支撑，并持续发挥独特的生态价值，推动产业合作共赢。 而对于这一不知人知的 B 面，很多人将其称之为英特尔隐形的翅膀，虽低调，但是影响力却不容小觑。
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
NETWORK-BASED COMPUTING LABORATORY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
THE OHIO STATE UNIVERSITY