1个多月了还是没解决这个难题，

train_generator = train_datagen.flow_from_directory(////本地路径
validation_generator = test_datagen.flow_from_directory(////本地路径

model.compile(optimizer='rmsprop',
loss='binary_crossentropy',
metrics=['accuracy')
metrics这里函数虽然可以自制，但是想不到方法来定义y_pred和y_test，网上找了很多教程也是各种报错，

model.fit_generator(
train_generator,
steps_per_epoch=22 // batch_size,
epochs=50,

1个回答

C医生 是2分类，关键是没有图像分类的pr曲线的python 代码
11 个月之前 回复
red cedar apple 混淆矩阵特别明了
11 个月之前 回复

opencv里计算recall和precision

Number Theory? 数字的理论
Problem Description In number theory, for a positive number N, two properties are often mentioned, one is Euler's function, short for E(N), another is factor number, short for F(N). To be more precise for newbie, here we recall the definition of E(N) and F(N) again. E(N) = |{i | gcd(N, i) = 1, 1 <= i <= N}| F(N) = |{i | N % i = 0, 1 <= i <= N}| Here |Set| indicates the different elements in the Set. As a number fanaticism, iSea want to solve a simple problem now. Given a integer N, try to find the number of intervals [l, r], l is no bigger than r obviously, strictly fit in the interval [1, N]. It's a piece of cake for clever you, of course. But here he also has another troublesome restrict: Input The first line contains a single integer T, indicating the number of test cases. Each test case includes one integer N. Technical Specification 1. 1 <= T <= 1 000 2. 1 <= N <= 1 000 000 000 Output For each test case, output the case number first, then the number of intervals. Sample Input 2 2 9 Sample Output Case 1: 1 Case 2: 6
keras下self-attention和Recall, F1-socre值实现问题？

keras结果ACC: 1.0000 Recall: 1.0000 F1-score: 1.0000 Precesion: 1.0000的原因？

tensorflow怎么写语义分割评价指标

Paint Mix 问题的一个计算
Description You are given two large pails. One of them (known as the black pail) contains B gallons of black paint. The other one (known as the white pail) contains W gallons of white paint. You will go through a number of iterations of pouring paint first from the black pail into the white pail, then from the white pail into the black pail. More specifically, in each iteration you first pour C cups of paint from the black pail into the white pail (and thoroughly mix the paint in the white pail), then pour C cups of paint from the white pail back into the black pail (and thoroughly mix the paint in the black pail). B, W, and C are positive integers; each of B and W is less than or equal to 50, and C < 16 * B (recall that 1 gallon equals 16 cups). The white pail's capacity is at least B+W. As you perform many successive iterations, the ratio of black paint to white paint in each pail will approach B/W. Although these ratios will never actually be equal to B/W one can ask: how many iterations are needed to make sure that the black-to-white paint ratio in each of the two pails differs from B/W by less than a certain tolerance. We define the tolerance to be 0.00001. Input The input consists of a number of lines. Each line contains input for one instance of the problem: three positive integers representing the values for B, W, and C, as described above. The input is terminated with a line where B = W = C = 0. Output Print one line of output for each instance. Each line of output will contain one positive integer: the smallest number of iterations required such that the black-to-white paint ratio in each of the two pails differs from B/W by less than the tolerance value. Sample Input 2 1 1 2 1 4 3 20 7 0 0 0 Sample Output 145 38 66
Typesetting 程序编写
Problem Description Modern fonts are generally of two varieties: outline fonts, whose glyphs (the individual character shapes) are specified mathematically as a set of curves, and bitmap fonts, whose glyphs are specified as patterns of pixels. Fonts may also include embedded information such as kerning pairs (adjusting the spacing between certain pairs of glyphs, such as "AW", so that they appear spaced correctly), tracking hints (for managing inter-glyph spacing), antialiasing hints (smoothing of pixellated edges), and much more. To be sure, modern fonts are more than a simple collection of shapes, and displaying them properly is a common programming challenge. For this problem we will concern ourselves with bitmapped fonts and a simple form of typesetting called glyph packing. Essentially, the idea is to pack the glyphs as tightly as possible while maintaining at least one horizontal pixel of separation between glyphs. For example, consider the glyphs shown to the left below for the Roman characters "P" and "J". The figure to the right shows them after glyph packing. Note that they are as close as possible without touching horizontally. Here's another example. In this case, notice that the final glyph cannot be packed at all. After packing, pixels from distinct glyphs may be adjacent diagonally or vertically, but not horizontally. The following example shows that pixels may be adjacent diagonally. The "Love" test case in the example input section shows that they may be adjacent vertically. Glyph packing has the nice property that it's easy to build "fancy" glyphs into the font so that glyph packing creates special effects with no extra work. Look at the "Toy" example below. The same simple packing process has been applied to these glyphs as to the ones above, but the result is more dramatic: Glyph packing has a few caveats, however, one of which we must concern ourselves with for this problem. Consider the example on the left below where a glyph for a hyphen is followed by a glyph for an underscore. Based on our one horizontal pixel of separation rule, how would this pack? Clearly something more is needed, and that something more is hinting within the glyphs themselves. Recall that in actual practice, fonts contain kerning pairs, tracking hints, etc. For our purposes, our hinting will be limited to "invisible" pixels that count as a pixel for the purpose of packing, but not for display. The center image below represents invisible pixels as open dots instead of closed dots. Now the two glyphs can be properly packed, resulting in the output shown on the right. Now for the formal definition of a proper packing: (1) Glyphs are packed as close as possible without allowing any pixels from different glyphs to be immediately horizontally adjacent; (2) Given two glyphs, they may not be packed in such a way that any pixel of the leftmost glyph at a given height ends up positioned to the right of any pixel at the same height in the rightmost glyph. Condition (2) above is easily understood by visualizing two glyphs sitting side by side, separated by a small space. If you "squeeze" them together, condition (2) says that their pixels are not allowed to "pass through" one another. Consider the example to the left below. The center image is not the proper packing, because it violates condition (2) of the formal definition. The image on the right is the proper packing of these glyphs. Input The input for this problem is sets of glyphs to be packed. In a given test case, all glyphs are the same height, and an integer, N, on the first line of the test case specifies this height. The next N lines contain the glyphs to be packed. Empty pixels in a glyph are represented by a dot '.' character. Non-empty pixels are represented by a hash mark '#' for visible pixels, and a zero '0' for invisible pixels. Glyphs are separated by a single column of space characters. The input will always consist of more than one glyph, at least one of which will always contain at least one visible pixel. A glyph will always have at least one non-empty pixel in its leftmost and rightmost column, and every glyph will have at least one non-empty pixel at the same height as at least one other glyph in the input. The minimum dimension of a glyph is 1 × 1, the maximum dimension is 20 × 20, and the maximum number of glyphs that will appear in any test case is 20. Test cases continue until a value of zero is specified for N. Output For each test case, first output the number of that test case (starting with 1) on a line by itself. Then output the proper packing of the input glyphs, using the dot '.' character for empty pixels and for invisible pixels, and the hash mark '#' character for visible pixels. Omit leading and trailing empty columns (columns with no visible pixels) so that both the leftmost and rightmost output columns contain at least one visible pixel. Sample Input 8 ###. ...# #..# ...# #..# ...# ###. ...# #... ...# #... ...# #... #..# #... #### 8 ############# .... ............. ..#.......... .... ............. ..#.......... .##. .........#..# ..#.......... #..# .........#..# ..#.......... #..# .........#..# ..#.......... .##. ..........### ............. .... ............# ............. .... ############. 8 ############# ............. ..#.......... ............. ..#.......... .........#..# ..#.......... .........#..# ..#.......... .........#..# ..#.......... ..........### ............. ............# ............. ############. 5 0..0 0..0 0..0 0..0 #### 0..0 0..0 0..0 0..0 #### 5 #.... .###. #.... #...# #...# #...# #...# ....# .###. ....# 3 ### 0.0 ### #.# 0.0 #.# ### 0.0 ### 3 0.0 ### 0.0 0.0 #.# 0.0 0.0 ### 0.0 8 #.... .... ..... .... #.... .... ..... .... #.... .##. #...# .##. #.... #..# .#.#. #..# #.... #..# .#.#. #..# #.... #..# .#.#. ###. #.... .##. ..#.. #... ##### .... ..#.. .### 0 Sample Output 1 ###..# #..#.# #..#.# ###..# #....# #....# #.#..# #.#### 2 ############# ..#.......... ..#..##..#..# ..#.#..#.#..# ..#.#..#.#..# ..#..##...### ............# ############. 3 .....############# .......#.......... .......#.#..#..... .......#.#..#..... .......#.#..#..... .......#..###..... ............#..... ############...... 4 ......... ......... ####..... ......... .....#### 5 #......###. #.....#...# #...#.#...# #...#.....# .###......# 6 ###.....### #.#.....#.# ###.....### 7 ### #.# ### 8 #.............. #.............. #..##.#...#.##. #.#..#.#.#.#..# #.#..#.#.#.#..# #.#..#.#.#.###. #..##...#..#... #####...#...###
Number Theory? 数字的表示问题
Problem Description In number theory, for a positive number N, two properties are often mentioned, one is Euler's function, short for E(N), another is factor number, short for F(N). To be more precise for newbie, here we recall the definition of E(N) and F(N) again. E(N) = |{i | gcd(N, i) = 1, 1 <= i <= N}| F(N) = |{i | N % i = 0, 1 <= i <= N}| Here |Set| indicates the different elements in the Set. As a number fanaticism, iSea want to solve a simple problem now. Given a integer N, try to find the number of intervals [l, r], l is no bigger than r obviously, strictly fit in the interval [1, N]. It's a piece of cake for clever you, of course. But here he also has another troublesome restrict: Input The first line contains a single integer T, indicating the number of test cases. Each test case includes one integer N. Technical Specification 1. 1 <= T <= 1 000 2. 1 <= N <= 1 000 000 000 Output For each test case, output the case number first, then the number of intervals. Sample Input 2 2 9 Sample Output Case 1: 1 Case 2: 6
Max Factor 正确实现的方式
Problem Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as better than others. In particular, a cow whose serial number has the highest prime factor enjoys the highest social standing among all the other cows. (Recall that a prime number is just a number that has no divisors except for 1 and itself. The number 7 is prime while the number 6, being divisible by 2 and 3, is not). Given a set of N (1 <= N <= 5,000) serial numbers in the range 1..20,000, determine the one that has the largest prime factor. Input * Line 1: A single integer, N * Lines 2..N+1: The serial numbers to be tested, one per line Output * Line 1: The integer with the largest prime factor. If there are more than one, output the one that appears earliest in the input file. Sample Input 4 36 38 40 42 Sample Output 38
Problem Description Rancher Joel has a tract of land in the shape of a convex quadrilateral that the wants to divide among his sons Al, Bob, Chas and Dave, who wish to continue ranching on their portions, and his daughter Emily, who wishes to grow vegetables on her portion. The center of the tract is most suitable for vegetable farming so Joel decides to divide the land by drawing lines from each corner (A, B, C, D in counter clockwise order) to the center of an opposing side (respectively A', B', C' and D') Each son would receive one of the triangular sections and Emily would receive the central quadrilateral section. As shown in the figure, Al's tract is to be bounded by the line from A to B, the line from A to the midpoint of BC and the line from B to the midpoint of CD' Bob&s ract is to be bounded by the line from B to C, the line from B to the midpoint of CD and the line from C to the midpoint of DA, and so on. Your job is to write a program that will help Rancher Joel determine the area of each child's tract and the length of the fence he will have to put around Emily's parcel to keep her brothers' cows out of her crops. For his problem, A will always be at (0, 0) and B will always be at (x, 0). Coordinates will be in rods (a rod is 16.5 feet).The returned areas should be in acres to 3 decimal places (an acre is 160 square rods) and the length of the fence should be in feet, rounded up to the next foot. Input The first line of input contains a single integer P( 1 <= P <= 1000),which is the number of data sets that follow. Each data set is a single line that contains of a decimal integer followed by five (5) space separated floating-point values. The first (integer) value is the data set number, N. The floating-point values are B.x, C.x, C.y, D.x and D.y in that order (where V.x indicates the x coordinate of V and V.y indicates the y coordinate of V). Recall that the y coordinate of B is always zero (0). The supplied coordinates will always specify a valid convex quadrilateral. Output For each data set there is a single line of output. It contains the data set number, N , followed by a single space followed by five(5) space separated floating-point values to three(3) decimal place accuracy, followed by a single space and a decimal integer! The floating-point values are the areas in acres of the properties of Al, Bob, Chas, Dave, and Emily respectively. The final integer is the length of fence in feet required to fence in Emily's property (rounded up to the next foot). Sample Input 3 1 200 250 150 -50 200 2 200 200 100 0 100 3 201.5 157.3 115.71 -44.2 115.71 Sample Output 1 35.000 54.136 75.469 54.167 54.666 6382 2 25.000 25.000 25.000 25.000 25.000 4589 3 29.144 29.144 29.144 29.144 29.144 4937

Typesetting 文字输出的实现方式
Problem Description Modern fonts are generally of two varieties: outline fonts, whose glyphs (the individual character shapes) are specified mathematically as a set of curves, and bitmap fonts, whose glyphs are specified as patterns of pixels. Fonts may also include embedded information such as kerning pairs (adjusting the spacing between certain pairs of glyphs, such as "AW", so that they appear spaced correctly), tracking hints (for managing inter-glyph spacing), antialiasing hints (smoothing of pixellated edges), and much more. To be sure, modern fonts are more than a simple collection of shapes, and displaying them properly is a common programming challenge. For this problem we will concern ourselves with bitmapped fonts and a simple form of typesetting called glyph packing. Essentially, the idea is to pack the glyphs as tightly as possible while maintaining at least one horizontal pixel of separation between glyphs. For example, consider the glyphs shown to the left below for the Roman characters "P" and "J". The figure to the right shows them after glyph packing. Note that they are as close as possible without touching horizontally. Here's another example. In this case, notice that the final glyph cannot be packed at all. After packing, pixels from distinct glyphs may be adjacent diagonally or vertically, but not horizontally. The following example shows that pixels may be adjacent diagonally. The "Love" test case in the example input section shows that they may be adjacent vertically. Glyph packing has the nice property that it's easy to build "fancy" glyphs into the font so that glyph packing creates special effects with no extra work. Look at the "Toy" example below. The same simple packing process has been applied to these glyphs as to the ones above, but the result is more dramatic: Glyph packing has a few caveats, however, one of which we must concern ourselves with for this problem. Consider the example on the left below where a glyph for a hyphen is followed by a glyph for an underscore. Based on our one horizontal pixel of separation rule, how would this pack? Clearly something more is needed, and that something more is hinting within the glyphs themselves. Recall that in actual practice, fonts contain kerning pairs, tracking hints, etc. For our purposes, our hinting will be limited to "invisible" pixels that count as a pixel for the purpose of packing, but not for display. The center image below represents invisible pixels as open dots instead of closed dots. Now the two glyphs can be properly packed, resulting in the output shown on the right. Now for the formal definition of a proper packing: (1) Glyphs are packed as close as possible without allowing any pixels from different glyphs to be immediately horizontally adjacent; (2) Given two glyphs, they may not be packed in such a way that any pixel of the leftmost glyph at a given height ends up positioned to the right of any pixel at the same height in the rightmost glyph. Condition (2) above is easily understood by visualizing two glyphs sitting side by side, separated by a small space. If you "squeeze" them together, condition (2) says that their pixels are not allowed to "pass through" one another. Consider the example to the left below. The center image is not the proper packing, because it violates condition (2) of the formal definition. The image on the right is the proper packing of these glyphs. Input The input for this problem is sets of glyphs to be packed. In a given test case, all glyphs are the same height, and an integer, N, on the first line of the test case specifies this height. The next N lines contain the glyphs to be packed. Empty pixels in a glyph are represented by a dot '.' character. Non-empty pixels are represented by a hash mark '#' for visible pixels, and a zero '0' for invisible pixels. Glyphs are separated by a single column of space characters. The input will always consist of more than one glyph, at least one of which will always contain at least one visible pixel. A glyph will always have at least one non-empty pixel in its leftmost and rightmost column, and every glyph will have at least one non-empty pixel at the same height as at least one other glyph in the input. The minimum dimension of a glyph is 1 × 1, the maximum dimension is 20 × 20, and the maximum number of glyphs that will appear in any test case is 20. Test cases continue until a value of zero is specified for N. Output For each test case, first output the number of that test case (starting with 1) on a line by itself. Then output the proper packing of the input glyphs, using the dot '.' character for empty pixels and for invisible pixels, and the hash mark '#' character for visible pixels. Omit leading and trailing empty columns (columns with no visible pixels) so that both the leftmost and rightmost output columns contain at least one visible pixel. Sample Input 8 ###. ...# #..# ...# #..# ...# ###. ...# #... ...# #... ...# #... #..# #... #### 8 ############# .... ............. ..#.......... .... ............. ..#.......... .##. .........#..# ..#.......... #..# .........#..# ..#.......... #..# .........#..# ..#.......... .##. ..........### ............. .... ............# ............. .... ############. 8 ############# ............. ..#.......... ............. ..#.......... .........#..# ..#.......... .........#..# ..#.......... .........#..# ..#.......... ..........### ............. ............# ............. ############. 5 0..0 0..0 0..0 0..0 #### 0..0 0..0 0..0 0..0 #### 5 #.... .###. #.... #...# #...# #...# #...# ....# .###. ....# 3 ### 0.0 ### #.# 0.0 #.# ### 0.0 ### 3 0.0 ### 0.0 0.0 #.# 0.0 0.0 ### 0.0 8 #.... .... ..... .... #.... .... ..... .... #.... .##. #...# .##. #.... #..# .#.#. #..# #.... #..# .#.#. #..# #.... #..# .#.#. ###. #.... .##. ..#.. #... ##### .... ..#.. .### 0 Sample Output 1 ###..# #..#.# #..#.# ###..# #....# #....# #.#..# #.#### 2 ############# ..#.......... ..#..##..#..# ..#.#..#.#..# ..#.#..#.#..# ..#..##...### ............# ############. 3 .....############# .......#.......... .......#.#..#..... .......#.#..#..... .......#.#..#..... .......#..###..... ............#..... ############...... 4 ......... ......... ####..... ......... .....#### 5 #......###. #.....#...# #...#.#...# #...#.....# .###......# 6 ###.....### #.#.....#.# ###.....### 7 ### #.# ### 8 #.............. #.............. #..##.#...#.##. #.#..#.#.#.#..# #.#..#.#.#.#..# #.#..#.#.#.###. #..##...#..#... #####...#...###
Typesetting 是怎么来实现的
Problem Description Modern fonts are generally of two varieties: outline fonts, whose glyphs (the individual character shapes) are specified mathematically as a set of curves, and bitmap fonts, whose glyphs are specified as patterns of pixels. Fonts may also include embedded information such as kerning pairs (adjusting the spacing between certain pairs of glyphs, such as "AW", so that they appear spaced correctly), tracking hints (for managing inter-glyph spacing), antialiasing hints (smoothing of pixellated edges), and much more. To be sure, modern fonts are more than a simple collection of shapes, and displaying them properly is a common programming challenge. For this problem we will concern ourselves with bitmapped fonts and a simple form of typesetting called glyph packing. Essentially, the idea is to pack the glyphs as tightly as possible while maintaining at least one horizontal pixel of separation between glyphs. For example, consider the glyphs shown to the left below for the Roman characters "P" and "J". The figure to the right shows them after glyph packing. Note that they are as close as possible without touching horizontally. Here's another example. In this case, notice that the final glyph cannot be packed at all. After packing, pixels from distinct glyphs may be adjacent diagonally or vertically, but not horizontally. The following example shows that pixels may be adjacent diagonally. The "Love" test case in the example input section shows that they may be adjacent vertically. Glyph packing has the nice property that it's easy to build "fancy" glyphs into the font so that glyph packing creates special effects with no extra work. Look at the "Toy" example below. The same simple packing process has been applied to these glyphs as to the ones above, but the result is more dramatic: Glyph packing has a few caveats, however, one of which we must concern ourselves with for this problem. Consider the example on the left below where a glyph for a hyphen is followed by a glyph for an underscore. Based on our one horizontal pixel of separation rule, how would this pack? Clearly something more is needed, and that something more is hinting within the glyphs themselves. Recall that in actual practice, fonts contain kerning pairs, tracking hints, etc. For our purposes, our hinting will be limited to "invisible" pixels that count as a pixel for the purpose of packing, but not for display. The center image below represents invisible pixels as open dots instead of closed dots. Now the two glyphs can be properly packed, resulting in the output shown on the right. Now for the formal definition of a proper packing: (1) Glyphs are packed as close as possible without allowing any pixels from different glyphs to be immediately horizontally adjacent; (2) Given two glyphs, they may not be packed in such a way that any pixel of the leftmost glyph at a given height ends up positioned to the right of any pixel at the same height in the rightmost glyph. Condition (2) above is easily understood by visualizing two glyphs sitting side by side, separated by a small space. If you "squeeze" them together, condition (2) says that their pixels are not allowed to "pass through" one another. Consider the example to the left below. The center image is not the proper packing, because it violates condition (2) of the formal definition. The image on the right is the proper packing of these glyphs. Input The input for this problem is sets of glyphs to be packed. In a given test case, all glyphs are the same height, and an integer, N, on the first line of the test case specifies this height. The next N lines contain the glyphs to be packed. Empty pixels in a glyph are represented by a dot '.' character. Non-empty pixels are represented by a hash mark '#' for visible pixels, and a zero '0' for invisible pixels. Glyphs are separated by a single column of space characters. The input will always consist of more than one glyph, at least one of which will always contain at least one visible pixel. A glyph will always have at least one non-empty pixel in its leftmost and rightmost column, and every glyph will have at least one non-empty pixel at the same height as at least one other glyph in the input. The minimum dimension of a glyph is 1 × 1, the maximum dimension is 20 × 20, and the maximum number of glyphs that will appear in any test case is 20. Test cases continue until a value of zero is specified for N. Output For each test case, first output the number of that test case (starting with 1) on a line by itself. Then output the proper packing of the input glyphs, using the dot '.' character for empty pixels and for invisible pixels, and the hash mark '#' character for visible pixels. Omit leading and trailing empty columns (columns with no visible pixels) so that both the leftmost and rightmost output columns contain at least one visible pixel. Sample Input 8 ###. ...# #..# ...# #..# ...# ###. ...# #... ...# #... ...# #... #..# #... #### 8 ############# .... ............. ..#.......... .... ............. ..#.......... .##. .........#..# ..#.......... #..# .........#..# ..#.......... #..# .........#..# ..#.......... .##. ..........### ............. .... ............# ............. .... ############. 8 ############# ............. ..#.......... ............. ..#.......... .........#..# ..#.......... .........#..# ..#.......... .........#..# ..#.......... ..........### ............. ............# ............. ############. 5 0..0 0..0 0..0 0..0 #### 0..0 0..0 0..0 0..0 #### 5 #.... .###. #.... #...# #...# #...# #...# ....# .###. ....# 3 ### 0.0 ### #.# 0.0 #.# ### 0.0 ### 3 0.0 ### 0.0 0.0 #.# 0.0 0.0 ### 0.0 8 #.... .... ..... .... #.... .... ..... .... #.... .##. #...# .##. #.... #..# .#.#. #..# #.... #..# .#.#. #..# #.... #..# .#.#. ###. #.... .##. ..#.. #... ##### .... ..#.. .### 0 Sample Output 1 ###..# #..#.# #..#.# ###..# #....# #....# #.#..# #.#### 2 ############# ..#.......... ..#..##..#..# ..#.#..#.#..# ..#.#..#.#..# ..#..##...### ............# ############. 3 .....############# .......#.......... .......#.#..#..... .......#.#..#..... .......#.#..#..... .......#..###..... ............#..... ############...... 4 ......... ......... ####..... ......... .....#### 5 #......###. #.....#...# #...#.#...# #...#.....# .###......# 6 ###.....### #.#.....#.# ###.....### 7 ### #.# ### 8 #.............. #.............. #..##.#...#.##. #.#..#.#.#.#..# #.#..#.#.#.#..# #.#..#.#.#.###. #..##...#..#... #####...#...###
How Many Fibs? 的问题
Problem Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b]. Input The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is terminated by a = b = 0. Otherwise, a <= b <= 10^100. The numbers a and b are given with no superfluous leading zeros. Output For each test case output on a single line the number of Fibonacci numbers fi with a <= fi <= b. Sample Input 10 100 1234567890 9876543210 0 0 Sample Output 5 4

Problem Description Rancher Joel has a tract of land in the shape of a convex quadrilateral that the wants to divide among his sons Al, Bob, Chas and Dave, who wish to continue ranching on their portions, and his daughter Emily, who wishes to grow vegetables on her portion. The center of the tract is most suitable for vegetable farming so Joel decides to divide the land by drawing lines from each corner (A, B, C, D in counter clockwise order) to the center of an opposing side (respectively A', B', C' and D') Each son would receive one of the triangular sections and Emily would receive the central quadrilateral section. As shown in the figure, Al's tract is to be bounded by the line from A to B, the line from A to the midpoint of BC and the line from B to the midpoint of CD' Bob&s ract is to be bounded by the line from B to C, the line from B to the midpoint of CD and the line from C to the midpoint of DA, and so on. Your job is to write a program that will help Rancher Joel determine the area of each child's tract and the length of the fence he will have to put around Emily's parcel to keep her brothers' cows out of her crops. For his problem, A will always be at (0, 0) and B will always be at (x, 0). Coordinates will be in rods (a rod is 16.5 feet).The returned areas should be in acres to 3 decimal places (an acre is 160 square rods) and the length of the fence should be in feet, rounded up to the next foot. Input The first line of input contains a single integer P( 1 <= P <= 1000),which is the number of data sets that follow. Each data set is a single line that contains of a decimal integer followed by five (5) space separated floating-point values. The first (integer) value is the data set number, N. The floating-point values are B.x, C.x, C.y, D.x and D.y in that order (where V.x indicates the x coordinate of V and V.y indicates the y coordinate of V). Recall that the y coordinate of B is always zero (0). The supplied coordinates will always specify a valid convex quadrilateral. Output For each data set there is a single line of output. It contains the data set number, N , followed by a single space followed by five(5) space separated floating-point values to three(3) decimal place accuracy, followed by a single space and a decimal integer! The floating-point values are the areas in acres of the properties of Al, Bob, Chas, Dave, and Emily respectively. The final integer is the length of fence in feet required to fence in Emily's property (rounded up to the next foot). Sample Input 3 1 200 250 150 -50 200 2 200 200 100 0 100 3 201.5 157.3 115.71 -44.2 115.71 Sample Output 1 35.000 54.136 75.469 54.167 54.666 6382 2 25.000 25.000 25.000 25.000 25.000 4589 3 29.144 29.144 29.144 29.144 29.144 4937
Paint Mix 代码的设计方式
Description You are given two large pails. One of them (known as the black pail) contains B gallons of black paint. The other one (known as the white pail) contains W gallons of white paint. You will go through a number of iterations of pouring paint first from the black pail into the white pail, then from the white pail into the black pail. More specifically, in each iteration you first pour C cups of paint from the black pail into the white pail (and thoroughly mix the paint in the white pail), then pour C cups of paint from the white pail back into the black pail (and thoroughly mix the paint in the black pail). B, W, and C are positive integers; each of B and W is less than or equal to 50, and C < 16 * B (recall that 1 gallon equals 16 cups). The white pail's capacity is at least B+W. As you perform many successive iterations, the ratio of black paint to white paint in each pail will approach B/W. Although these ratios will never actually be equal to B/W one can ask: how many iterations are needed to make sure that the black-to-white paint ratio in each of the two pails differs from B/W by less than a certain tolerance. We define the tolerance to be 0.00001. Input The input consists of a number of lines. Each line contains input for one instance of the problem: three positive integers representing the values for B, W, and C, as described above. The input is terminated with a line where B = W = C = 0. Output Print one line of output for each instance. Each line of output will contain one positive integer: the smallest number of iterations required such that the black-to-white paint ratio in each of the two pails differs from B/W by less than the tolerance value. Sample Input 2 1 1 2 1 4 3 20 7 0 0 0 Sample Output 145 38 66
Queens, Knights and Pawns 编程的思想
Description You all are familiar with the famous 8-queens problem which asks you to place 8 queens on a chess board so no two attack each other. In this problem, you will be given locations of queens and knights and pawns and asked to find how many of the unoccupied squares on the board are not under attack from either a queen or a knight (or both). We'll call such squares "safe" squares. Here, pawns will only serve as blockers and have no capturing ability. The board below has 6 safe squares. (The shaded squares are safe.) Recall that a knight moves to any unoccupied square that is on the opposite corner of a 2x3 rectangle from its current position; a queen moves to any square that is visible in any of the eight horizontal, vertical, and diagonal directions from the current position. Note that the movement of a queen can be blocked by another piece, while a knight's movement can not. Input There will be multiple test cases. Each test case will consist of 4 lines. The first line will contain two integers n and m, indicating the dimensions of the board, giving rows and columns, respectively. Neither integer will exceed 1000. The next three lines will each be of the form k r1 c1 r2 c2 ... rk ck indicating the location of the queens, knights and pawns, respectively. The numbering of the rows and columns will start at one. There will be no more than 100 of any one piece. Values of n = m = 0 indicate end of input. Output Each test case should generate one line of the form Board b has s safe squares. where b is the number of the board (starting at one) and you supply the correct value for s. Sample Input 4 4 2 1 4 2 4 1 1 2 1 2 3 2 3 1 1 2 1 1 1 0 1000 1000 1 3 3 0 0 0 0 Sample Output Board 1 has 6 safe squares. Board 2 has 0 safe squares. Board 3 has 996998 safe squares.
《奇巧淫技》系列-python！！每天早上八点自动发送天气预报邮件到QQ邮箱

Linux(服务器编程):15---两种高效的事件处理模式（reactor模式、proactor模式）

C语言魔塔游戏

​ 进程通信是指进程之间的信息交换。这里需要和进程同步做一下区分，进程同步控制多个进程按一定顺序执行，进程通信是一种手段，而进程同步是目标。从某方面来讲，进程通信可以解决进程同步问题。 ​ 首先回顾下我们前面博文中讲到的信号量机制，为了实现进程的互斥与同步，需要在进程间交换一定的信息，因此信号量机制也可以被归为进程通信的一种方式，但是也被称为低级进程通信，主要原因为： 效率低：一次只可操作少量的...

Python爬虫爬取淘宝，京东商品信息

Java工作4年来应聘要16K最后没要,细节如下。。。

2020年，冯唐49岁：我给20、30岁IT职场年轻人的建议

##1、骇客帝国(1999) 概念：在线/离线，递归，循环，矩阵等 剧情简介： 不久的将来，网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂，并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他，现实世界其实是由一个名叫“母体”的计算机人工智能系统控制，人们就像他们饲养的动物，没有自由和思想，而尼奥就是能够拯救人类的救世主。 可是，救赎之路从来都不会一帆风顺，到底哪里才是真实的世界？

Python绘图，圣诞树，花，爱心 | Turtle篇

CPU对每个程序员来说，是个既熟悉又陌生的东西？ 如果你只知道CPU是中央处理器的话，那可能对你并没有什么用，那么作为程序员的我们，必须要搞懂的就是CPU这家伙是如何运行的，尤其要搞懂它里面的寄存器是怎么一回事，因为这将让你从底层明白程序的运行机制。 随我一起，来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说，我们首先就要搞明白它是怎么回事，也就是它的内部构造，当然，CPU那么牛的一个东

2020年1月17日，国家统计局发布了2019年国民经济报告，报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏，但是很多人并没有看到我国复杂的人口问题：老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧！ 一、背景 1.人口突破14亿 2020年1月17日，国家统计局发布了 2019年国民经济报告 ，报告中指出：年末中国大陆总人口（包括31个

2020年的1月，我辞掉了我的第一份工作

Java坑人面试题系列: 包装类（中级难度）
Java Magazine上面有一个专门坑人的面试题系列: https://blogs.oracle.com/javamagazine/quiz-2。 这些问题的设计宗旨，主要是测试面试者对Java语言的了解程度，而不是为了用弯弯绕绕的手段把面试者搞蒙。 如果你看过往期的问题，就会发现每一个都不简单。 这些试题模拟了认证考试中的一些难题。 而 “中级(intermediate)” 和 “高级(ad

By 超神经场景描述：昨天 2 月 3 日，是大部分城市号召远程工作的第一天，全国有接近 2 亿人在家开始远程办公，钉钉上也有超过 1000 万家企业活跃起来。关键词：十一出行 人脸...
Java基础知识点梳理
Java基础知识点梳理 摘要： 虽然已经在实际工作中经常与java打交道，但是一直没系统地对java这门语言进行梳理和总结，掌握的知识也比较零散。恰好利用这段时间重新认识下java，并对一些常见的语法和知识点做个总结与回顾，一方面为了加深印象，方便后面查阅，一方面为了学好java打下基础。 Java简介 java语言于1995年正式推出，最开始被命名为Oak语言，由James Gosling（詹姆
2020年全新Java学习路线图，含配套视频，学完即为中级Java程序员！！

B 站上有哪些很好的学习资源?