
回答 3 已采纳 Problem Description
After years as a bricklayer, you've been called upon to analyze the structural integrity of various brick walls built by the Tetrad Corporation. Instead
of using regularsized bricks, the Tetrad Corporation seems overly fond of bricks made out of strange shapes. The structural integrity of a wall can be
approximated by the fewest number of bricks that could be removed to create a gap from the top to the bottom. Can you determine that number for
various odd walls created by Tetrad?
Input
Input to this problem will begin with a line containing a single integer X (1 ≤ X ≤ 100) indicating the number of data sets. Each data set consists of
two components:
A single line, "M N" (1 ≤ M,N ≤ 20) where M and N indicate the height and width (in units), respectively, of a brick wall;
A series of M lines, each N alphabetic characters in length. Each character will indicate to which brick that unit of the wall belongs to. Note
that bricks will be contiguous; each unit of a brick will be adjacent (diagonals do not count as adjacent) to another unit of that brick. Multiple
bricks may use the same characters for their representation, but any bricks that use identical characters will not be adjacent to each other. All
letters will be uppercase.
Output
For each data set, output the fewest number of bricks to remove to create a gap that leads from some point at the top of the wall, to some point at the
bottom of the wall. Assume that bricks are in fixed locations and do not "fall" if bricks are removed from beneath them. A gap consists of contiguous
units of removed bricks; each unit of a gap must be adjacent (diagonals do not count) to another unit of the gap.
Sample Input
3
5 7
AABBCCD
EFFGGHH
IIJJKKL
MNNOOPP
QQRRSST
5 7
AABBCCD
AFFBGGD
IIJBKKD
MNNOOPD
QQRRSST
6 7
ABCDEAB
ABCFEAB
AEAABAB
ACDAEEB
FFGAHIJ
KLMANOP
Sample Output
5
2
2

回答 2 已采纳 Problem Description
Today is Young F's 3rd birthday. His father gives him a set of magic toy bricks as a birthday gift, which contains a total of n bricks identified from 1 to n. Young F can set the height of every brick as an arbitrary integer h, which ranges from 1 to m(1≤h≤m). Young F loves the gift, and then he has fun with the bricks according to the following steps.
(1)step 1: take the No.1 toy brick, set its height h1 arbitrarily, place it at the beginning of the first row.
(2)step i (assuming there has been r rows formed by the previous i−1 toy bricks):take the No.i toy brick, and there are two operations which Young F can take:
(I) set its height hi arbitrarily, place No.i toy brick at the beginning of the r+1 row to create a new row(row r+1)
(II)select an arbitrary row from the existed r rows, set the height of new brick hi so that hi must be not less than the height of the last toy brick of selected row, then append No.i toy block to the selected row.
(3) operation ends when n toy blocks are used out, and the whole bricks can form a certain shape.
Young F is curious about how many different shapes will be formed with the whole bricks in all possible operations.
For two shapes, if the number of the rows is same, and the number of the bricks in corresponding row is also same, and the ID as well as the height of the brick at the corresponding position is still same, the two shapes are considered as the same shape.
Input
Multiple test cases, the first line contains an integer T(no more than 50), indicating the number of cases.Each test case contains two integer n(1≤n≤1000) and m(1≤m≤100000), representing the number of bricks and the maximal height of toy bricks.
Output
For each case，the output should occupies exactly one line. The output format is Case #x: ans, here x is the data number begins at 1, ans is the total number mod 1000000007.
Sample Input
2
1 1
2 2
Sample Output
Case #1: 1
Case #2: 7

回答 1 已采纳 There's a game called Brick Game. In this game, the player controls a number of bricks on a 9*9 grid. In every step, the player has 3 choices. One is rotating the 9*9 grid clockwise; The second is rotating the 9*9 grid counterclockwise; The third is dropping a pattern sized 1*3 bricks(you should treat them separately) down from the middle of the upest line. Each brick has a kind of color. After each step, the bricks that hang in the air will drop down until they touch other bricks or the bottom, then three or more adjacent bricks will be removed if they have the same color(here we call two bricks that share a common border "adjacent"). This process will go on until no brick can be removed. In this problem, you are asked to simulate the whole process. The 9*9 grid is empty at the beginning. A list of what the player has done will be given. You should output the final situation after all the operation by the player.
Input:
The input consists of several test cases. Each test case contains several lines. There's a operation in each line, which can be 'CW', 'CCW', 'DROP' as the description above. If the operation is 'DROP', it will be followed by a string contains exactly upper letters. In the string, each upper letter represents a kind of color. There're five kinds of color, R(red), G(green), B(blue), Y(yellow), W(white). The end for each test case is always a line contains 'END'.
Output:
The output of each test case contains a string of "FAIL" or a final situation with 9*9 grid. "FAIL" should be output if the drop operation fails during the process, i.e. there're bricks in the three middle of the upest line when the player want to drop a new pattern. Note that output the whole 9*9 grid and use a '.' represents the empty grid. Output a blank line after each test case.
Sample Input:
DROP RGB
CW
CCW
END
DROP RGB
DROP RGB
DROP RGB
END
Sample Output:
.........
.........
.........
.........
.........
.........
.........
.........
......RGB
.........
.........
.........
.........
.........
.........
.........
.........
.........

回答 1 已采纳 问题描述 :
Kingdom LHOH is celebrating its annual carnival again!This time another crazy game is now on show.N*N piles of brick here lying on the ground in a straight line, and N brave fellows have attended.
First they should each choose a distinct piles brick to stand behind, forming a line parrelling to the brick, and facing the same side, watching at his piles of brick.
Then their captain can yelled out 3 commands, described below:
A "LEFT!" Every one should move so that he is behind the left piles of the original one.
B "RIGHT!" Every one should move so that he is behind the right piles of the original one.
C "HIT!" Every one should break all the piles of brick before him with only his head slamming them.
A little constraints are showed below:
In every step, when command A or B have been yelled out, no one should move outside, that is, for everyone after his moving, brick(even breaked up) is there before him,and when command C is to be yelled out, intact piles of brick must be there before every one, so that he cannot slamming brick that it already breaked up, and only that is fair to everyone.
Not until all piles of brick have been successfully breaked up with the brave fellows’ heads, this game is successfully finished.
Now the question is,the crazy captain wants to know how many initial options are there,satisfying for each initial option he always chooses the first piles, other members choose their own distinct ones,and the game can be finished successfully at the same time?
We assume the other members except the captain cannot be told out.
输入:
First there’s an integer T(T<=15000) indicating the scenary numbers.
Then there’s T lines represented for the scenaries, with an integer N(1<=N<=10^12) in each line.
输出:
First there’s an integer T(T<=15000) indicating the scenary numbers.
Then there’s T lines represented for the scenaries, with an integer N(1<=N<=10^12) in each line.
样例输入:
10
1
2
3
4
8
16
6469693228
6469693229
6469693230
1024
样例输出:
1
2
2
6
20
70
84
14
8787513806478134
184756

回答 1 已采纳 Description
Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfect shape and nice tall towers. Instead, he ordered to build the wall around the whole castle using the least amount of stone and labor, but demanded that the wall should not come closer to the castle than a certain distance. If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will loose his head. Moreover, he demanded Architect to introduce at once a plan of the wall listing the exact amount of resources that are needed to build the wall.
Your task is to help poor Architect to save his head, by writing a program that will find the minimum possible length of the wall that he could build around the castle to satisfy King's requirements.
The task is somewhat simplified by the fact, that the King's castle has a polygonal shape and is situated on a flat ground. The Architect has already established a Cartesian coordinate system and has precisely measured the coordinates of all castle's vertices in feet.
Input
The first line of the input file contains two integer numbers N and L separated by a space. N (3 <= N <= 1000) is the number of vertices in the King's castle, and L (1 <= L <= 1000) is the minimal number of feet that King allows for the wall to come close to the castle.
Next N lines describe coordinates of castle's vertices in a clockwise order. Each line contains two integer numbers Xi and Yi separated by a space (10000 <= Xi, Yi <= 10000) that represent the coordinates of ith vertex. All vertices are different and the sides of the castle do not intersect anywhere except for vertices.
Output
Write to the output file the single number that represents the minimal possible length of the wall in feet that could be built around the castle to satisfy King's requirements. You must present the integer number of feet to the King, because the floating numbers are not invented yet. However, you must round the result in such a way, that it is accurate to 8 inches (1 foot is equal to 12 inches), since the King will not tolerate larger error in the estimates.
Sample Input
9 100
200 400
300 400
300 300
400 300
400 400
500 400
500 200
350 200
200 200
Sample Output
1628

回答 1 已采纳 Problem Description
Nanjing University of Science and Technology is celebrating its 60th anniversary. In order to make room for student activities, to make the university a more pleasant place for learning, and to beautify the campus, the college administrator decided to start construction on an open space.
The designers measured the open space and come to a conclusion that the open space is a rectangle with a length of n meters and a width of m meters. Then they split the open space into n x m squares. To make it more beautiful, the designer decides to cover the open space with 1 x 1 bricks and 1 x 2 bricks, according to the following rules:
1. All the bricks can be placed horizontally or vertically
2. The vertexes of the bricks should be placed on integer lattice points
3. The number of 1 x 1 bricks shouldn’t be less than C or more than D. The number of 1 x 2 bricks is unlimited.
4. Some squares have a flowerbed on it, so it should not be covered by any brick. (We use 0 to represent a square with flowerbet and 1 to represent other squares)
Now the designers want to know how many ways are there to cover the open space, meeting the above requirements.
Input
There are several test cases, please process till EOF.
Each test case starts with a line containing four integers N(1 <= N <= 100), M(1 <= M <= 10), C, D(1 <= C <= D <= 20). Then following N lines, each being a string with the length of M. The string consists of ‘0’ and ‘1’ only, where ‘0’ means the square should not be covered by any brick, and ‘1’ otherwise.
Output
Please print one line per test case. Each line should contain an integers representing the answer to the problem (mod 109 + 7).
Sample Input
1 1 0 0
1
1 1 1 2
0
1 1 1 2
1
1 2 1 2
11
1 2 0 2
01
1 2 0 2
11
2 2 0 0
10
10
2 2 0 0
01
10
2 2 0 0
11
11
4 5 3 5
11111
11011
10101
11111
Sample Output
0
0
1
1
1
2
1
0
2
954

回答 1 已采纳 Problem Description
Brickgao used to be a real tall, wealthy, handsome man and you might know him well. If you don't, please draw attention to the details below.
Brickgao tried his fortune in investment of golden bricks with his two partners LS and Jne. Because he knew little about investment he gave his total trust and bank savings to his two partners who looked smart.
However, due to the bad luck and lack of business skills, LS and Jne used up Brickgao's fund, and nothing in return. Their investment failed and the three become diaosi.
Brickgao had no other choice but to earn a living as a construction worker and he found his place on a building site moving bricks which of course was not golden ones. There were many brick fragment scattered on the site and workers had to move them to the building that under construction. Brickgao was made to cope with the task.
The problem is that the Brickgao couldn’t carry more than two bricks at a time since they were too heavy. Also, if he had taken a brick, he couldn’t put it anywhere except the goal building — his inherent sense of order does not let him do so.
You are given N pairs of coordinates of the bricks and the coordinates of the goal building. It is known that the Brickgao covers the distance between any two points in the time equal to the squared length of the segment between the points. It is also known that initially the coordinates of the Brickgao and the goal building are the same. You are asked to find such an order of bricks, that the Brickgao could move all the bricks to the building in a minimum time period. You can assume the no two bricks shared the same coordinates. If more than one optimum moving sequence Brickgao could find, he would choose the smallest lexicographic one because of the inherent sense of order.
Input
The first line of the input file contains an integer T which indicates the number of test cases. The first line of each case contains the building's coordinates x ,y. The second line contains number N (1<= N < 20) — the amount of bricks on the building site. The following N lines contain the bricks' coordinates. All the coordinates do not exceed 100 in absolute value. All the given positions are different. All the numbers are integer.
Output
For each test case, first you should print "Case x:" in a line, where x stands for the case number started with 1. Then two lines follow: the first line output the only number — the minimum time Brickgao needed to move the bricks to building, and the second line output the optimum order for Brickgao to move the bricks. Each brick in the input is described by its index number (from 1 to N).
Sample Input
2
0 0
2
1 1
1 1
1 1
3
4 3
3 4
0 0
Sample Output
Case 1:
8
1 2
Case 2:
32
1 2 3

暮志未晚Webgl的博客 案例查看地址：http://www.wjceo.com/blog/threejs/20180503/155.html 简介 凹凸贴图用于为材质增加厚度。我们用到的凹凸贴图是一张灰度图，当然你也可以使用彩色图。像素的密集程度定义的是凹凸的高度，但是... 
破砖人 碎砖机游戏，由js Live View

海岛Blog的博客 There is a village in Bangladesh, where brick game is very popular. Brick game is a team game. Each team consists of odd number of players. Number of players must be greater than 1 but cannot be great... 
小灰灰52309的博客 Brick Wall There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line fro 
海岛Blog的博客 If we want to build a brick wall out of the usual size of brick which has a length twice as long as its height, and if our wall is to be two units tall, we can make our wall in a number of patterns, d... 
我不是费圆的博客 brick.className = "brick"; brick.style.left = j * b_width + "px";//设置每一个砖块的left值 brick.style.top = i * b_height + "px";//设置每一个砖块的top值 brick.style.backgroundColor = bgColor(); bricks... 
BlueSky_USC的博客 eneryList.add(brick); } //读到2画金币 if(map[i][j]==2){ cion = new Pipe(j*30,i*30,30,30,new ImageIcon("image/coin_brick.png").getImage()); eneryList.add(cion); } //... 
冰 河的博客 这个例子比较了字符串“yellow”和另外几个值：“brick”、“yellow”、“zoo”。因为“brick”在字母表中排在“yellow”之前，所以localeCompare()返回了1；而“yellow”等于“yellow”，所以localeCompare()返回了... 
HaiRong_21的博客 纯js写的一个小游戏（跟着视频做的，bug问题我还没解决） bug主要是 ： 滑动底部滑块的时候，点击的太频繁了会让鼠标抬起时不触发相应的函数。 阿弥陀佛，我尽力了。 html部分： <div id="div1"> <div ... 
余功鹏的博客 转载：https://github.com/matiu2/rackspacearticles/blob/master/glusterfs/howtoaddandremoveanode.md ...Gluster FS  How to add and remove a node Prerequisites Following on from our pre 
_心之所向_的博客 js < script > function Brick ( ) { this . box = document . querySelector ( ".box" ) ; this . ball = document . querySelector ( ".ball" ) ; this . guard = document . ... 
yuaiqiuhongyan的博客 用JS实现一个简单的打砖块游戏 话不多说，先看看效果： HTML架构部分 <! HTML结构 > <div class="content"> <div class="game"></div> <div class="container"> <h2>打... 
zoyoy的博客 游戏音效功能还没有完善，后续会修改。 源代码 项目演示地址 github源码下载地址 ...index.js代码 var game = { canvas : document.getElementById('canvas'), ctx : canvas.getContext('2d'), clientWidth: ...