 Digits on the Floor 代码实现的思想

Problem Description
Taro attempts to tell digits to Hanako by putting straight bars on the floor. Taro wants to express each digit by making one of the forms shown in Figure 2.Since Taro may not have bars of desired lengths, Taro cannot always make forms exactly as shown in Figure 2. Fortunately, Hanako can recognize a form as a digit if the connection relation between bars in the form is kept. Neither the lengths of bars nor the directions of forms affect Hanako抯 perception as long as the connection relation remains the same. For example, Hanako can recognize all the awkward forms in Figure 3 as digits. On the other hand, Hanako cannot recognize the forms in Figure 4 as digits. For clarity, touching bars are slightly separated in Figures 2, 3 and 4. Actually, touching bars overlap exactly at one single point.
In the forms, when a bar touches another, the touching point is an end of at least one of them. That is, bars never cross. In addition, the angle of such two bars is always a right angle.
To enable Taro to represent forms with his limited set of bars, positions and lengths of bars can be changed as far as the connection relations are kept. Also, forms can be rotated. Keeping the connection relations means the following.
?Separated bars are not made to touch.
?Touching bars are not made separate.
?When one end of a bar touches another bar, that end still touches the same bar. When ittouches a midpoint of the other bar, it remains to touch a midpoint of the same bar on the same side.
?The angle of touching two bars is kept to be the same right angle (90 degrees and −90 degrees are considered different, and forms for 2 and 5 are kept distinguished). Your task is to find how many times each digit appears on the floor. The forms of some digits always contain the forms of other digits. For example, a form for 9 always contains four forms for 1, one form for 4, and two overlapping forms for 7. In this problem, ignore the forms contained in another form and count only the digit of the 搇argest?form composed of all mutually connecting bars. If there is one form for 9, it should be interpreted as one appearance of 9 and no appearance of 1, 4, or 7.
Input
The input consists of a number of datasets. Each dataset is formatted as follows.n
x1a y1a x1b y1bx2a y2a x2b y2b
...
xna yna xnb xnb
In the first line, n represents the number of bars in the dataset. For the rest of the lines, one line represents one bar. Four integers xa, ya, xb, yb, delimited by single spaces, are given in each line. xa and ya are the x and ycoordinates of one end of the bar, respectively. xb and yb are those of the other end. The coordinate system is as shown in Figure 5. You can assume 1 ≤ n ≤ 1000 and 0 ≤ xa; ya; xb; yb ≤ 1000. The end of the input is indicated by a line containing one zero.
You can also assume the following conditions.
More than two bars do not overlap at one point.
Every bar is used as a part of a digit. Nondigit forms do not exist on the floor.
A bar that makes up one digit does not touch nor cross any bar that makes up another digit.
There is no bar whose length is zero.
Output
For each dataset, output a single line containing ten integers delimited by single spaces. These integers represent how many times 0, 1, 2, . . . , and 9 appear on the floor in this order.
Output lines must not contain other characters.Sample Input
9
60 140 200 300
300 105 330 135
330 135 250 215
240 205 250 215
298 167 285 154
30 40 30 90
30 90 150 90
150 90 150 20
30 40 150 40
8
320 20 300 60
320 20 380 50
380 50 240 330
10 50 40 20
10 50 110 150
110 150 180 80
40 20 37 17
37 17 27 27
20
72 222 132 182
204 154 204 54
510 410 520 370
404 54 204 54
530 450 410 450
204 68 404 68
80 110 120 30
130 160 180 60
520 370 320 320
310 360 320 320
120 30 180 60
60 100 80 110
404 154 204 154
80 60 60 100
430 550 590 550
510 410 310 360
430 450 430 550
404 54 404 154
232 202 142 262
142 262 102 202
0Sample Output
0 1 0 1 0 0 0 0 0 1
0 0 0 0 0 1 0 1 0 0
1 0 1 0 2 0 0 0 1 0
Digits 数字位数的问题_course
20200622Problem Description A googol written out in decimal has 101 digits. A googolplex has one plus a googol digits. That's a lot of digits! Given any number x0, define a sequence using the following recurrence: xi+1 = the number of digits in the decimal representation of xi Your task is to determine the smallest positive i such that xi = xi1. Input Input consists of several lines. Each line contains a value of x0. Every value of x0 is nonnegative and has no more than one million digits. The last line of input contains the word END. Output For each value of x0 given in the input, output one line containing the smallest positive i such that xi = xi1. Sample Input 42 END Sample Output 3
Digits on the Floor 数字的表示问题_course
20200219Problem Description Taro attempts to tell digits to Hanako by putting straight bars on the floor. Taro wants to express each digit by making one of the forms shown in Figure 2. Since Taro may not have bars of desired lengths, Taro cannot always make forms exactly as shown in Figure 2. Fortunately, Hanako can recognize a form as a digit if the connection relation between bars in the form is kept. Neither the lengths of bars nor the directions of forms affect Hanako抯 perception as long as the connection relation remains the same. For example, Hanako can recognize all the awkward forms in Figure 3 as digits. On the other hand, Hanako cannot recognize the forms in Figure 4 as digits. For clarity, touching bars are slightly separated in Figures 2, 3 and 4. Actually, touching bars overlap exactly at one single point. In the forms, when a bar touches another, the touching point is an end of at least one of them. That is, bars never cross. In addition, the angle of such two bars is always a right angle. To enable Taro to represent forms with his limited set of bars, positions and lengths of bars can be changed as far as the connection relations are kept. Also, forms can be rotated. Keeping the connection relations means the following. ?Separated bars are not made to touch. ?Touching bars are not made separate. ?When one end of a bar touches another bar, that end still touches the same bar. When ittouches a midpoint of the other bar, it remains to touch a midpoint of the same bar on the same side. ?The angle of touching two bars is kept to be the same right angle (90 degrees and −90 degrees are considered different, and forms for 2 and 5 are kept distinguished). Your task is to find how many times each digit appears on the floor. The forms of some digits always contain the forms of other digits. For example, a form for 9 always contains four forms for 1, one form for 4, and two overlapping forms for 7. In this problem, ignore the forms contained in another form and count only the digit of the 搇argest?form composed of all mutually connecting bars. If there is one form for 9, it should be interpreted as one appearance of 9 and no appearance of 1, 4, or 7. Input The input consists of a number of datasets. Each dataset is formatted as follows. n x1a y1a x1b y1b x2a y2a x2b y2b ... xna yna xnb xnb In the first line, n represents the number of bars in the dataset. For the rest of the lines, one line represents one bar. Four integers xa, ya, xb, yb, delimited by single spaces, are given in each line. xa and ya are the x and ycoordinates of one end of the bar, respectively. xb and yb are those of the other end. The coordinate system is as shown in Figure 5. You can assume 1 ≤ n ≤ 1000 and 0 ≤ xa; ya; xb; yb ≤ 1000. The end of the input is indicated by a line containing one zero. You can also assume the following conditions. More than two bars do not overlap at one point. Every bar is used as a part of a digit. Nondigit forms do not exist on the floor. A bar that makes up one digit does not touch nor cross any bar that makes up another digit. There is no bar whose length is zero. Output For each dataset, output a single line containing ten integers delimited by single spaces. These integers represent how many times 0, 1, 2, . . . , and 9 appear on the floor in this order. Output lines must not contain other characters. Sample Input 9 60 140 200 300 300 105 330 135 330 135 250 215 240 205 250 215 298 167 285 154 30 40 30 90 30 90 150 90 150 90 150 20 30 40 150 40 8 320 20 300 60 320 20 380 50 380 50 240 330 10 50 40 20 10 50 110 150 110 150 180 80 40 20 37 17 37 17 27 27 20 72 222 132 182 204 154 204 54 510 410 520 370 404 54 204 54 530 450 410 450 204 68 404 68 80 110 120 30 130 160 180 60 520 370 320 320 310 360 320 320 120 30 180 60 60 100 80 110 404 154 204 154 80 60 60 100 430 550 590 550 510 410 310 360 430 450 430 550 404 54 404 154 232 202 142 262 142 262 102 202 0 Sample Output 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 0 2 0 0 0 1 0
Digits on the Floor 数字的问题_course
20200831Problem Description Taro attempts to tell digits to Hanako by putting straight bars on the floor. Taro wants to express each digit by making one of the forms shown in Figure 2. Since Taro may not have bars of desired lengths, Taro cannot always make forms exactly as shown in Figure 2. Fortunately, Hanako can recognize a form as a digit if the connection relation between bars in the form is kept. Neither the lengths of bars nor the directions of forms affect Hanako抯 perception as long as the connection relation remains the same. For example, Hanako can recognize all the awkward forms in Figure 3 as digits. On the other hand, Hanako cannot recognize the forms in Figure 4 as digits. For clarity, touching bars are slightly separated in Figures 2, 3 and 4. Actually, touching bars overlap exactly at one single point. In the forms, when a bar touches another, the touching point is an end of at least one of them. That is, bars never cross. In addition, the angle of such two bars is always a right angle. To enable Taro to represent forms with his limited set of bars, positions and lengths of bars can be changed as far as the connection relations are kept. Also, forms can be rotated. Keeping the connection relations means the following. ?Separated bars are not made to touch. ?Touching bars are not made separate. ?When one end of a bar touches another bar, that end still touches the same bar. When ittouches a midpoint of the other bar, it remains to touch a midpoint of the same bar on the same side. ?The angle of touching two bars is kept to be the same right angle (90 degrees and −90 degrees are considered different, and forms for 2 and 5 are kept distinguished). Your task is to find how many times each digit appears on the floor. The forms of some digits always contain the forms of other digits. For example, a form for 9 always contains four forms for 1, one form for 4, and two overlapping forms for 7. In this problem, ignore the forms contained in another form and count only the digit of the 搇argest?form composed of all mutually connecting bars. If there is one form for 9, it should be interpreted as one appearance of 9 and no appearance of 1, 4, or 7. Input The input consists of a number of datasets. Each dataset is formatted as follows. n x1a y1a x1b y1b x2a y2a x2b y2b ... xna yna xnb xnb In the first line, n represents the number of bars in the dataset. For the rest of the lines, one line represents one bar. Four integers xa, ya, xb, yb, delimited by single spaces, are given in each line. xa and ya are the x and ycoordinates of one end of the bar, respectively. xb and yb are those of the other end. The coordinate system is as shown in Figure 5. You can assume 1 ≤ n ≤ 1000 and 0 ≤ xa; ya; xb; yb ≤ 1000. The end of the input is indicated by a line containing one zero. You can also assume the following conditions. More than two bars do not overlap at one point. Every bar is used as a part of a digit. Nondigit forms do not exist on the floor. A bar that makes up one digit does not touch nor cross any bar that makes up another digit. There is no bar whose length is zero. Output For each dataset, output a single line containing ten integers delimited by single spaces. These integers represent how many times 0, 1, 2, . . . , and 9 appear on the floor in this order. Output lines must not contain other characters. Sample Input 9 60 140 200 300 300 105 330 135 330 135 250 215 240 205 250 215 298 167 285 154 30 40 30 90 30 90 150 90 150 90 150 20 30 40 150 40 8 320 20 300 60 320 20 380 50 380 50 240 330 10 50 40 20 10 50 110 150 110 150 180 80 40 20 37 17 37 17 27 27 20 72 222 132 182 204 154 204 54 510 410 520 370 404 54 204 54 530 450 410 450 204 68 404 68 80 110 120 30 130 160 180 60 520 370 320 320 310 360 320 320 120 30 180 60 60 100 80 110 404 154 204 154 80 60 60 100 430 550 590 550 510 410 310 360 430 450 430 550 404 54 404 154 232 202 142 262 142 262 102 202 0 Sample Output 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 0 2 0 0 0 1 0
代码实现，Shortest Path on a Cylinder_course
20190830Problem Description Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another. Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer. Input There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder. For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0)  (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h). You may assume that r!=radius only when h=0 or h=height for each point. Warning: There are about one thousand test cases. Be careful with the time efficiency. Output For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point. Sample Input 2 5 10 10 0 3 5 0 5 90 49 49 312 39 0 52 65 Sample Output Case #1: 7.00 Case #2: 171.02
Restoring the digits _course
20171017Description Let's consider arithmetic expressions (addition or subtraction) over nonnegative decimal integers. The expression syntax is as follows: the first operand; the operator sign ('+'); the second operand; the character '='; the result of the operation (sum or difference, according to the operator). The operands don't exceed 999 999 999. In case of subtraction the first operand should be greater than or equal to the second one. There are no spaces in the expression. Uppercase Latin letters are substituted for some digits (possibly including insignificant zeroes) so that identical letters correspond to identical digits and different letters correspond to different digits. It is guaranteed that at least one such substitution is made. The task is to restore the substituted digits. Input The input contains only one line with the encoded arithmetic expression. Output The output consists of several lines. Each line describes one substitution and contains a letter and the corresponding digit. The letter and the digit should be separated by exactly one space. The strings should be sorted in the ascending order of letters. Letters not used in the substitution should not be listed. Sample Input 103K+G0G1=CG36 Sample Output C 1 G 0 K 5
Sum of Digits 的实现问题_course
20200112Problem Description Petka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched his head and said: "Well, Petka, I won't find just your number, but I can find the smallest fitting number." Can you do the same? Input The first line contains the number of test cases t (no more than 10000). In each of the following t lines there are numbers s1 and s2 (1 ≤ s1, s2 ≤ 10000) separated by a space. They are the sum of digits and the sum of squared digits of the number n. Output For each test case, output in a separate line the smallest fitting number n, or "No solution" if there is no such number or if it contains more than 100 digits. Sample Input 4 9 81 12 9 6 10 7 9 Sample Output 9 No solution 1122 111112
Flying to the Mars代码如何完整输出_course
20190826Problem Description In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow who ruling the Mars . Here the problem comes! How can the soldiers reach the Mars ? PPF convokes his soldiers and asks for their suggestions . “Rush … ” one soldier answers. “Shut up ! Do I have to remind you that there isn’t any road to the Mars from here!” PPF replies. “Fly !” another answers. PPF smiles :“Clever guy ! Although we haven’t got wings , I can buy some magic broomsticks from HARRY POTTER to help you .” Now , it’s time to learn to fly on a broomstick ! we assume that one soldier has one level number indicating his degree. The soldier who has a higher level could teach the lower , that is to say the former’s level > the latter’s . But the lower can’t teach the higher. One soldier can have only one teacher at most , certainly , having no teacher is also legal. Similarly one soldier can have only one student at most while having no student is also possible. Teacher can teach his student on the same broomstick .Certainly , all the soldier must have practiced on the broomstick before they fly to the Mars! Magic broomstick is expensive !So , can you help PPF to calculate the minimum number of the broomstick needed . For example : There are 5 soldiers (A B C D E)with level numbers : 2 4 5 6 4; One method : C could teach B; B could teach A; So , A B C are eligible to study on the same broomstick. D could teach E;So D E are eligible to study on the same broomstick; Using this method , we need 2 broomsticks. Another method: D could teach A; So A D are eligible to study on the same broomstick. C could teach B; So B C are eligible to study on the same broomstick. E with no teacher or student are eligible to study on one broomstick. Using the method ,we need 3 broomsticks. …… After checking up all possible method, we found that 2 is the minimum number of broomsticks needed. Input Input file contains multiple test cases. In a test case,the first line contains a single positive number N indicating the number of soldiers.(0<=N<=3000) Next N lines :There is only one nonnegative integer on each line , indicating the level number for each soldier.( less than 30 digits); Output For each case, output the minimum number of broomsticks on a single line. Sample Input 4 10 20 30 04 5 2 3 4 3 4 Sample Output 1 2
The buses 正确代码的解答_course
20190921Problem Description Garfield applied for a good job recently, and he will go to work soon by car or bus. Garfield is very broody, sometimes when he sits on the bus to wait for the traffic light, he thinks about how long all the buses pass the traffic turning. Now we describe the situations when the buses stop at the traffic turning to wait for the traffic light. First the light is red, then when the light changes to green, all the buses are prepared to move. And at the beginning, all the buses are close to each other without any space, and they have different lengths and the largest speeds. We assume any car can reach the speed that isn’t beyond the maximal speed at once. Now Garfield wants you to calculate minimal time all the buses pass the turning. Input There are many cases. For each case, there is two intergers N(1<=N<=100), representing the number of the buses. There are two interges in the following N lines, for the length Li(meter, 1<=Li<=10) and the maximal speed Si(meter/second, 1<=Si<=10) of the ith bus. Output For each case, print the result obtaining two digits after the decimal point. Sample Input 2 1 2 2 3 Sample Output 1.50
Once Around the Lock 具体的思想_course
20191222Problem Description Most of us at one time or another have used a circular combination lock (think back to those glorious days in high school and your gym locker). Most combination locks consist of a dial with the numbers 0 through n1 printed on it in clockwise order. The dial can be turned either clockwise or counterclockwise, bringing one of the numbers to the top of the dial (if 0 is at the top of the dial, a turn of 1 in the counterclockwise direction would bring 1 to the top). Each lock has a three number code (x, y, z) and can only be opened after the following series of steps: 1. The lock dial must first be spun clockwise at least one full rotation, ending with the number x at the top (with no intervening counterclockwise turns). Note this could be accomplished with consecutive clockwise turns. 2. The lock must be turned counterclockwise until the number y appears at the top for the second time. Note this could be accomplished with consecutive counterclockwise turns (but no intervening clockwise turns). 3. The lock must then be turned clockwise until the number z appears on top, without going more than one full rotation. Note this could be accomplished with consecutive clockwise turns (but no intervening counterclockwise turns). Any rotation after this last step will cause the lock to be closed again. For this problem, you will be given a lock and a series of turns and you must determine at the end whether or not the lock is open. You should assume prior to the first turn that the lock has just been closed, and the dial spun counterclockwise until 0 is on top. Input Input will consist of multiple test cases. The first line of each test case will contain four integers n x y z, indicating the number of digits on the lock’s dial and the threenumber combination (x, y and z will all be different and n <= 1000). The next line(s) will consist of a series of dial rotations of the form d s, where d is either C or CC (for clockwise or counterclockwise) and s (> 0) indicates how many numbers to spin through at the top of the dial. For example, if n = 50 and the current number on top of the dial is 4, the rotation CC 6 would bring the number 10 to the top, while a rotation of C 6 would bring 48 to the top. The series of dial rotations may extend over multiple lines, ending with the character ?. A line with a single 0 on it will follow the last test case. Output For each problem instance, output a single line containing either the word Open or Closed, prefaced by the test case number as shown in the sample output. Sample Input 60 6 1 58 C 114 CC 115 C 3 ? 60 6 1 58 C 54 CC 115 C 3 ? 60 6 1 58 C 54 C 60 CC 115 C 3 ? 0 Sample Output Case 1: Open Case 2: Closed Case 3: Open
运用C语言来解决，代码的实现_course
20190822Problem Description The Bathysphere is a spherical deepsea submersible which was unpowered and lowered into the ocean on a cable, and was used to conduct a series of dives under the sea. The Bathysphere was designed for studying undersea wildlife. The Bathysphere was conducted from the deck of a ship. After counted, the ship should not move, so choosing the position where the Bathysphere was conducted is important. A group of scientists want to study the secrets of undersea world along the equator, and they would like to use the Bathysphere. They want to choose the position where the Bathysphere can dive as deep as possible. Before conducting the Bathysphere, they have a map of the seabed, which tell them the shape of the seabed. They draw a line on the equator of the map to mark where they will release the Bathysphere, as a number axis. Suppose the axis is draw from 0 to L. But when they release the Bathysphere, they can't know where they are accurately, i.e., if they choose position x to release the Bathysphere, the real position will distribute between xd and x+d with an equal probability, where d is given. The objective of the scientists is very simple, i.e., to maximize the expected depth. For the ease of presentation, the shape of the seabed is described as a poly line. Given N points ) , ( Xi,Yi ) as the vertices, where Xi and Yi indicate the position and the depth of the ith vertex, respectively, the ploy line is composed of the line segments that connect consecutive vertices. Input The first line contains an integer T (1 ≤ T ≤ 25), the number of test cases. Then T test cases follow. In each test case, the first line contains two integers N (2 ≤ N ≤ 2*10^5) and L (2 ≤ L ≤ 10^9), as described above. Then N lines follow, each line contains two integer Xi and Yi (1≤i≤N, 0≤ Yi ≤10^9), where point ( Xi,Yi ) is a vertex of the ploy line. It is assumed that X1 == 0 and Xn == L and Xi < Xi+1 for 1 ≤ i < N. Then the following line contains one integer d (0 ≤ d ≤ L/2), as described above. Output For each test case, choose a position between d and Ld, both inclusive, to conducted the Bathysphere, and calculate the expected depth. Output the expected depth in a line, rounded to 3 digits after the decimal point. Sample Input 2 3 10 0 3 4 10 10 1 5 3 10 0 3 4 10 10 1 1 Sample Output 5.900 9.192
Examining the Rooms 程序代码_course
20200202Problem Description A murder happened in the hotel. As the best detective in the town, you should examine all the N rooms of the hotel immediately. However, all the doors of the rooms are locked, and the keys are just locked in the rooms, what a trap! You know that there is exactly one key in each room, and all the possible distributions are of equal possibility. For example, if N = 3, there are 6 possible distributions, the possibility of each is 1/6. For convenience, we number the rooms from 1 to N, and the key for Room 1 is numbered Key 1, the key for Room 2 is Key 2, etc. To examine all the rooms, you have to destroy some doors by force. But you don’t want to destroy too many, so you take the following strategy: At first, you have no keys in hand, so you randomly destroy a locked door, get into the room, examine it and fetch the key in it. Then maybe you can open another room with the new key, examine it and get the second key. Repeat this until you can’t open any new rooms. If there are still rooms unexamined, you have to randomly pick another unopened door to destroy by force, then repeat the procedure above, until all the rooms are examined. Now you are only allowed to destroy at most K doors by force. What’s more, there lives a Very Important Person in Room 1. You are not allowed to destroy the doors of Room 1, that is, the only way to examine Room 1 is opening it with the corresponding key. You want to know what is the possibility of that you can examine all the rooms finally. Input The first line of the input contains an integer T (T ≤ 200), indicating the number of test cases. Then T cases follow. Each case contains a line with two numbers N and K. (1 < N ≤ 20, 1 ≤ K < N) Output Output one line for each case, indicating the corresponding possibility. Four digits after decimal point are preserved by rounding. Sample Input 3 3 1 3 2 4 2 Sample Output 0.3333 0.6667 0.6250
Warrior Lady 代码实现方式_course
20200209Problem Description "Killers of Three Kingdoms" is a popular role playing card game designed with the novel Romance of the Three Kingdoms. The game has four kinds of "Equipment Card": "Armour", "Weapon", "+1 horse", "1 horse". Each player has an equippeditem area to hold equipments. A player is allowed to own only one of each of these 4 equipments in the equippeditem area. Equipments can be replaced by one of the same kind. However, after the replacement, the previous ones would be discarded. For simplicity, cards not belong to equipment (tool cards, basic cards and so on) are united as "Other Card" ignoring their functions in this problem. Sun Shangxiang(Nickname: Xiangxiang), the lady with bow and arrows, is one of the favorable characters in this game. Her 2nd character ability  "Warrior Lady" (枭姬xiāo jī in Chinese) is described below: Whenever an equipped card is discarded from the equippeditem area, Xiangxiang can immediately draw 2 cards from the deck. Note that Xiangxiang cannot voluntarily remove her equipped items. She can only replace them. Now it is Xiangxiang’s turn. She has a certain amount of cards of each kind in her hand and her equippeditem area is empty. Given the number of cards of each kind in the deck, assume that every card in the deck will be taken with equal probability, and Xiangxiang will always equip the "Equipment Card" once she gets it. What is the expected number of cards Xiangxiang can draw in her action phase? Input In the first line there is an integer T, indicates the number of test cases. (T <= 100) For each case, two lines are given. The first line describes Xiangxiang’s hand cards, 5 integers indicating the number of "Armour", "Weapon", "+1 horse", "1 horse" and "Other Card" respectively. The second line describes the cards in the deck which has the same format as above. The sum of the 10 integers is no more than 104. Output For each case, output "Case k: v" on a single line, in which k is the case number, v is the maximum expected number of cards Xiangxiang can draw round to 2 digits after decimal point. Sample Input 3 2 0 0 0 0 0 0 0 0 1 0 0 0 5 0 0 0 0 0 9 0 0 0 2 0 0 0 0 1 2 Sample Output Case 1: 1.00 Case 2: 8.00 Case 3: 2.67
The buses 的代码设计_course
20190901Problem Description Garfield applied for a good job recently, and he will go to work soon by car or bus. Garfield is very broody, sometimes when he sits on the bus to wait for the traffic light, he thinks about how long all the buses pass the traffic turning. Now we describe the situations when the buses stop at the traffic turning to wait for the traffic light. First the light is red, then when the light changes to green, all the buses are prepared to move. And at the beginning, all the buses are close to each other without any space, and they have different lengths and the largest speeds. We assume any car can reach the speed that isn’t beyond the maximal speed at once. Now Garfield wants you to calculate minimal time all the buses pass the turning. Input There are many cases. For each case, there is two intergers N(1<=N<=100), representing the number of the buses. There are two interges in the following N lines, for the length Li(meter, 1<=Li<=10) and the maximal speed Si(meter/second, 1<=Si<=10) of the ith bus. Output For each case, print the result obtaining two digits after the decimal point. Sample Input 2 1 2 2 3 Sample Output 1.50
Shoot the Airplane 飞机算法思想_course
20200208Problem Description XXX is playing an interesting game which is based on a 2D plane. In this game, he is required to shoot an airplane. The airplane flies horizontally. The shape of it can be regarded as a simple polygon. Player has to shoot at point (0, 0) upward vertically. Because the bullet is very small, it can be regarded as a point. The airplane is hit only if the bullet goes into the airplane. The airplane is not hit if the bullet only touches the edge of the airplane. The gravity should be considered. The acceleration of gravity is g and its direction is downward vertically. So the speed of the bullet may be change during flying. But the speed of airplane is constant because it has engines. XXX wants to know the time it takes the bullet to hit the airplane after shooting. Input There are multiple cases. In each case, there are three integers v (10<= v <= 10), b (1 <= b <= 10), g (0 <= g <= 10) in the first line. v denotes the speed of airplane. The flying direction is from left to right if v is positive and the direction is from right to left if v is negative. b denotes the initial speed of bullet. g is the acceleration of gravity. Then the input will describe the position of the airplane when XXX shoots. In the second line, there is one integer n (3 <= n <= 20) which represents the number of vertexes of the airplane (polygon). In each of the next n lines, there are two integers x (100 <= x <= 100), y (0 <y<= 100) which give the position of a vertex in order. There is a blank line after each case. The input ends with 0 0 0. Output If the airplane is hit, then output the time it takes the bullet to hit it after shooting in one line. The answer should be rounded to 2 digits after decimal point. If the airplane is not hit, then output “Miss!” in one line. Sample Input 10 10 2 9 6 9 10 9 10 16 25 16 25 20 10 20 10 27 6 27 10 18 10 10 2 9 6 9 10 9 10 16 20 16 20 20 10 20 10 27 6 27 10 18 0 0 0 Sample Output 2.00 Miss!
Grocery store 怎么程序代码的实现_course
20190915Problem Description A cashier in a grocery store seems to have difficulty in distinguishing the multiplication symbol and the addition symbol. To make things easier for him, you want to buy goods in such a way that the product of their prices is the same as the sum of their prices. Of course, if you buy only one item, this is always true. With two items and three items, it still seems quite a boring task to you, so now you are interested in finding possible prices of four items such that the sum of the four prices is equal to the product of the four prices. You should consider the prices are in with two digits after the decimal point. Obviously, each product costs at least one cent. Input This problem has no input. Output Print all solutions which have a sum of the four items of at most 20.00 . For each solution, print one line with the prices of the four items in nondecreasing order, with one space character between them. You may print the solutions in any order, but make sure to print each solution only once. Sample Output 0.50 1.00 2.50 16.00 1.25 1.60 1.75 1.84 1.25 1.40 1.86 2.00 ...
Steganography 代码实现的原理_course
20200918Problem Description In cryptography, the goal is to encrypt a message so that, even if the the message is intercepted, only the intended recipient can decrypt it. In steganography, which literally means "hidden writing", the goal is to hide the fact that a message has even been sent. It has been in use since 440 BC. Historical methods of steganography include invisible inks and tatooing messages on messengers where they can't easily be seen. A modern method is to encode a message using the leastsignificant bits of the RGB color values of pixels in a digital image. For this problem you will uncover messages hidden in plain text. The spaces within the text encode bits; an odd number of consecutive spaces encodes a 0 and an even number of consecutive spaces encodes a 1. The four texts in the example input below (terminated by asterisks) encode the following bit strings: 11111, 000010001101101, 01, and 000100010100010011111. Each group of five consecutive bits represents a binary number in the range 0–31, which is converted to a character according to the table below. If the last group contains fewer than five bits, it is padded on the right with 0's. " " (space) 0 "A" – "Z" 1–26 "'" (apostrophe) 27 "," (comma) 28 "" (hyphen) 29 "." (period) 30 "?" (question mark) 31 The first message is 111112 = 3110 = "?". The second message is (00001, 00011, 01101)2 = (1, 3, 13)10 = "ACM". The third message is 010002 = 810 = "H", where the underlined 0's are padding bits. The fourth message is (00010, 00101, 00010, 01111, 10000)2 = (2, 5, 2, 15, 16)10 = "BEBOP". Input The input consists of one or more texts. Each text contains one or more lines, each of length at most 80 characters, followed by a line containing only "*" (an asterisk) that signals the end of the text. A line containing only "#" signals the end of the input. In addition to spaces, text lines may contain any ASCII letters, digits, or punctuation, except for "*" and "#", which are used only as sentinels. Output For each input text, output the hidden message on a line by itself. Hidden messages will be 1–64 characters long. Note: Input text lines and output message lines conform to all of the whitespace rules listed in item 7 of Notes to Teams except that there may be consecutive spaces within a line. There will be no spaces at the beginning or end of a line. Sample Input Programmer, I would like to see a question mark. * Behold, there is more to me than you might think when you read me the first time. * Symbol for hydrogen? * A B C D E F G H I J K L M N O P Q R S T U V * # Sample Output ? ACM H BEBOP
Angry Birds Again 代码思想_course
20191231Problem Description luyi0619 loves playing the popular game – angry bird. You haven’t heard about it? Oh, my god! You are out, I think. The following hyperlink to Wikipedia will help you. http://en.wikipedia.org/wiki/Angry_Birds Every day, he spends lot of time playing the game. You know, as time goes, he will be bored. This time, when he hits a pig successfully he wants to calculate the distance that bird covers. As a clever programmer, can you help him to solve the problem? The gravity acceleration is 9.80 m/s^2. Input The first line contains only one integer T (T is about 100) indicates the number of test cases. For each case there are five integers x0,y0,x1,y1,t; x0,y0 is the bird’s position. x1,y1 is the pig’s position. t is the time that the bird used to cover the distance. All integers above are nonnegative and in the range [0,100] x0 and x1 are never equal. Output One line for each case specifying the distance rounded to three digits. If the pig can’t be hit in the given time, output “Impossible.” without the quotes. Sample Input 1 0 0 2 2 1 Sample Output 3.687
Jogging 实现的思想_course
20191220Description It's Sunday, November 1, 2390, and Eddy has just been elected to the World Council. Of course, it is a very interesting and responsible job, and Eddy is eager to work in the Council, but there is a problem: Eddy is keen on sport. In particular, he likes jogging and he has been jogging at least thirty minutes each day of his life since he was a little boy. Now Eddy will have even less free time than ever before, when he was just a teacher. How will he find spare time for jogging? Eddy decided that he would jog on his way to his work. Of course, the Council building is rather far away from his house, so he wants to combine jogging with travelling by public transport. Now it has to be told that the moving pathways are the only means of public transport in the Capital. Each line of pathways consists of a pair of straight pathways running in opposite directions with the same speed v1 > 0. These pathways are very long and relatively narrow, so for the purpose of this task they can be considered sharing an infinite straight line on the plane. Besides, for each pathway two numbers are given, Ti+and Ti  the time necessary for boarding and leaving this pathway. Note that crossing a pathway doesn't take any additional time, but changing from the ith pathway to the jth in their intersection point (which in fact is not an intersection since there are special bridges built at these points) takes exactly Ti + Tj+ seconds. Of course, Eddy wants to jog also on the pathways, so he'll move along the pathways with the ground speed v1 + v2 where v2 > 0 is the speed of Eddy while jogging on still ground. Now he wants you to find a route from his house to the Council building that would require as little time as possible. This route should consist of several segments, some of which can lie on one of the existing pathways. Input The first line of input consists of a single integer N , 0 <= N <= 50  the number of pairs of moving pathways in the city. The second line contains six real numbers x1 , y1 , x2 , y2 , v1 , v2 , separated by spaces  the coordinates of Eddy's house and of the Council building, and the speed of pathways and of Eddy respectively. Each of the next N lines contains a description of a pathway consisting of six real numbers xi1 , yi1 , xi2 , yi2 , Ti+ and Ti, where (xi1 , yi1 ) and (xi2 , yi2 ) are two different points on the pathway and 0 <= Ti+ , Ti <= 10 are the boarding and leaving times. All coordinates do not exceed 10000 by their absolute values, and v1 and v2 are real numbers ranging from 1 to 100. All pathways lie on different straight lines. Neither (x1 , y1 ) nor (x2 , y2 ) lie on any of the pathways. Output First line of output must contain one real number T  the minimal travel time required. The second line must contain one integer 0 < M <= 300  the number of segments from which the optimal path is composed. Each of the next M lines should consist of one integer 0 <= kj <= N , the number of the pathway taken (0 means no pathway used), and of the coordinates Xj , Yj of the end of jth segment of this path. All real numbers are to be output with six digits after decimal point. Sample Input 2 100 100 200 100 2.92893219 7.07106781 0 0 1 0 0 0 2000 0 2000 1 0 0 Sample Output 50.000000 3 0 0.000000 0.000000 1 100.000000 0.000000 0 200.000000 100.000000
Consecutive Digits_course
20191212Problem Description As a recruiting ploy, Google once posted billboards in Harvard Square and in the Silicon Valley area just stating “{first 10digit prime found in consecutive digits of e}.com”. In other words, find that 10digit sequence and then connect to the web site— and find out that Google is trying to hire people who can solve a particular kind of problem. Not to be outdone, Gaggle (a loosygoosy fuzzy logic search firm), has devised its own recruiting problem. Consider the base 7 expansion of a rational number. For example, the first few digits of the base 7 expansion of 1/510 = 0.12541...7,33/410 = 11.15151...7, and 6/4910 = 0.06000...7, From this expansion, find the digits in a particular range of positions to the right of the "decimal" point. Input The input file begins with a line containing a single integer specifying the number of problem sets in the file. Each problem set is specified by four base 10 numbers on a single line, n d b e, where n and d are the numerator and denominator of the rational number and 0 ≤ n ≤ 5,000 and 1 ≤ d ≤ 5,000. b and e are the beginning and ending positions for the desired range of digits, with 0 ≤ b,e ≤ 250 and 0 ≤ (eb) ≤ 20. Note that 0 is the position immediately to the right of the decimal point. Output Each problem set will be numbered (beginning at one) and will generate a single line: Problem k: n / d, base 7 digits b through e: result where k is replaced by the problem set number, result is your computed result, and the other values are the corresponding input values. Sample Input 4 1 5 0 0 6 49 1 3 33 4 2 7 511 977 122 126 Sample Output Problem set 1: 1 / 5, base 7 digits 0 through 0: 1 Problem set 2: 6 / 49, base 7 digits 1 through 3: 600 Problem set 3: 33 / 4, base 7 digits 2 through 7: 151515 Problem set 4: 511 / 977, base 7 digits 122 through 126: 12425
Sum of Digits 数码的和的问题_course
20190902Problem Description Petka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched his head and said: "Well, Petka, I won't find just your number, but I can find the smallest fitting number." Can you do the same? Input The first line contains the number of test cases t (no more than 10000). In each of the following t lines there are numbers s1 and s2 (1 ≤ s1, s2 ≤ 10000) separated by a space. They are the sum of digits and the sum of squared digits of the number n. Output For each test case, output in a separate line the smallest fitting number n, or "No solution" if there is no such number or if it contains more than 100 digits. Sample Input 4 9 81 12 9 6 10 7 9 Sample Output 9 No solution 1122 111112
 3.64MB
Xshell6完美破解版，亲测可用
20181226Xshell6破解版，亲测可用，分享给大家。直接解压即可使用
MySQL数据库从入门到实战课
20191231限时福利1：购课进答疑群专享柳峰（刘运强）老师答疑服务。 为什么说每一个程序员都应该学习MySQL？ 根据《20192020年中国开发者调查报告》显示，超83%的开发者都在使用MySQL数据库。 使用量大同时，掌握MySQL早已是运维、DBA的必备技能，甚至部分IT开发岗位也要求对数据库使用和原理有深入的了解和掌握。 学习编程，你可能会犹豫选择 C++ 还是 Java；入门数据科学，你可能会纠结于选择 Python 还是 R；但无论如何， MySQL 都是 IT 从业人员不可或缺的技能！ 【课程设计】 在本课程中，刘运强老师会结合自己十多年来对MySQL的心得体会，通过课程给你分享一条高效的MySQL入门捷径，让学员少走弯路，彻底搞懂MySQL。 本课程包含3大模块： 一、基础篇： 主要以最新的MySQL8.0安装为例帮助学员解决安装与配置MySQL的问题，并对MySQL8.0的新特性做一定介绍，为后续的课程展开做好环境部署。 二、SQL语言篇： 本篇主要讲解SQL语言的四大部分数据查询语言DQL，数据操纵语言DML，数据定义语言DDL，数据控制语言DCL，学会熟练对库表进行增删改查等必备技能。 三、MySQL进阶篇： 本篇可以帮助学员更加高效的管理线上的MySQL数据库；具备MySQL的日常运维能力，语句调优、备份恢复等思路。
 Docker（下）(Docker镜像、容器数据卷、编写DockerFile) 409020201024写博客即是为了记录自己的学习历程，也希望能够结交志同道合的朋友一起学习。文章在撰写过程中难免有疏漏和错误，欢迎指出文章的不足之处；更多内容请点进爱敲代码的小游子查看。 临渊羡鱼，不如退而结网。一起加油！ 一、Docker镜像 镜像是什么？ 镜像是一种轻量级、可执行的独立软件包，用来打包软件运行环境和基于运行环境开发的软件，它包含运行某个软件所需的所有内容，包括代码、运行时、库、环境变量和配置文件 （1）UnionFS(联合文件系统) UnionFS（联合文件系统）：Union文件系统是一种分层、轻量级..
 3.16MB
AB153XUT络达1562A检测工具最新版
20200928解压密码是FNF//////666,请输入字母和数字部分中间删去. 安卓系统下的络达1562A检测软件AB153XUT. 市场鱼龙混杂,在不拆机的情况下用此软件大致判断出是否是真1562a.
 学院 SpringBoot2.0实战教程
 下载 原生Js与jquery的多组处理, 仅展开一个区块的折叠效果
 学院 20年设计模式教程/head first/java面试题/idea/s
 学院 UI自动化测试全家桶
 学院 项目构建工具Maven
 下载 JQuery 1.3.2以上版本中出现pareseerror错误的解决方法
 博客 linux文件存在内存里
 学院 Java+FFmpeg开发音视频流媒体直播等
 学院 2020年新版Java零基础入门视频教程
 下载 基于jquery的高性能td和input切换并可修改内容实现代码
 下载 asp中格式化HTML函数代码 SDCMS加强版
 博客 Mac电脑上安装python,pycharm
 博客 window caps 转换成 ctrl 按键映射
 博客 Flume1.7.0下载及安装部署
 下载 JS中动态添加事件(绑定事件)的代码
 博客 8.14 Linux内核中的头文件
 博客 Node.js面试题大全（一）
 博客 8.11 头文件剖析：前向引用
 学院 Java微信小程序母婴用品商城 大学生毕业设计教学视频
 博客 JQuery注册表单
 博客 linux云计算应用管理(配置Linux网络 、源码编译安装)
 博客 [C#] CHO.Json操作Json数据
 下载 JavaScript中URL编码函数代码
 下载 js对数字的格式化使用说明
 下载 Chrome中JSON.parse的特殊实现
 下载 php算开始时间到过期时间的相隔的天数
 博客 波场链Tronchain可以做多久？是个能赚大钱的平台么
 博客 2020.10.28【读书笔记】丨生物信息学与功能基因组学（第一章 引言）
 下载 JavaScript定义类或函数的几种方式小结
 学院 专为AI小白设计的人工智能实战课