HBC24711盲人骑瞎马、夜半临深池[USACO 2010 Jan B]Theater Seating题解

水水月牙 算法基础篇 35 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
The cows have built an amphitheater with seats in the form of a rectangle with *odd* width W (11

The cows have built an amphitheater with seats in the form of a rectangle with *odd* width W (11 <= W <= 101) and with R rows (4 <= R <= 50) of seats. The distance between two adjacent seats on the same row is the same as the distance between a pair of seats that are in front of/behind each other on adjacent rows. The cows wish to sell tickets over the internet and have automatic seating assignment for each ticket they sell. Ticket purchasers always want the best seat, so every seat has a unique 'priority' associated with it (even if some seats might appear to the layman to have the same priority). The middle seat of the first row (which is closest to the stage) is located at 1,(W+1)/2 and has the very best priority. The closest seats (euclidean distance!) to it have the next set of best values. The next closest seats have slightly worse values, and so on. All seats of equal distance on the first row are better than all seats of that same distance on the second row (and so on). Since some seats are equidistant from the best seat, those on the same row that are closest to seat number 1 (the left-most seat when the seats are viewed from the stage) are given better priority (see the diagram below). Here's a diagram of a small (11 x 5) theater where the seat's 'priority' is shown with #1 being the best: Seat Number 1 2 3 4 5 6 7 8 9 10 11 +---------------------------------- Row 5 | 54 50 44 38 32 29 33 39 45 51 55 Row 4 | 52 42 34 25 21 18 22 26 35 43 53 Row 3 | 48 36 23 14 12 9 13 15 24 37 49 Row 2 | 46 30 19 10 5 4 6 11 20 31 47 Row 1 | 40 27 16 7 2 1 3 8 17 28 41 Write a program that prints the seating priority chart for a supplied width and row count.

HBC24711盲人骑瞎马、夜半临深池[USACO 2010 Jan B]Theater Seating题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC24711盲人骑瞎马 夜半临深池[USACO 2010 Jan B]Theater Seating题解