hdu moving tables程序顯示wa
hdu moving tables程序顯示wa
Problem Description
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.
The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, only one table can pass through the corridor. Some plan is needed to make the moving efficient. The manager figured out the following plan: Moving a table from a room to another room can be done within 10 minutes. When moving a table from room i to room j, the part of the corridor between the front of room i and the front of room j is used. So, during each 10 minutes, several moving between two rooms not sharing the same part of the corridor will be done simultaneously. To make it clear the manager illustrated the possible cases and impossible cases of simultaneous moving.
For each room, at most one table will be either moved in or moved out. Now, the manager seeks out a method to minimize the time to move all the tables. Your job is to write a program to solve the manager’s problem.
Input
The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case begins with a line containing an integer N , 1
Problem Description
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.
The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, only one table can pass through the corridor. Some plan is needed to make the moving efficient. The manager figured out the following plan: Moving a table from a room to another room can be done within 10 minutes. When moving a table from room i to room j, the part of the corridor between the front of room i and the front of room j is used. So, during each 10 minutes, several moving between two rooms not sharing the same part of the corridor will be done simultaneously. To make it clear the manager illustrated the possible cases and impossible cases of simultaneous moving.
For each room, at most one table will be either moved in or moved out. Now, the manager seeks out a method to minimize the time to move all the tables. Your job is to write a program to solve the manager’s problem.
Input
The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case begins with a line containing an integer N , 1
其他人氣:820 ℃時間:2020-06-14 05:59:19
優(yōu)質(zhì)解答
這個是要用貪心算法或把走廊分為200段的那個方法的,你這里應該要對t【】進行從小到大的排序,而且最后 if (flag[j]==0 && (s[i]>t[j] || t[i]
我來回答
類似推薦
- 英語翻譯
- 如圖,在平行四邊形ABCD中,E,F分別是BC,DC的中點,G為交點.若AB=a,AD=b,試以a,b為基底表示DE,BF,CG.(a,b,AB,AD,DE,BF,CG均為向量)
- 描寫雨聲的句子
- 三角函數(shù)的變換公式有哪些?
- 難解的幾何題
- 《海濱仲夏夜》的特點
- 一個三角形和一個平行四邊形的面積和底都相等.三角形的高是5cm,平行四邊形的高是()cm
- 已知關(guān)于x的方程a(3x-2)+b(2x-3)=8x-7 問題看下!
- 問一個英語句型問題The letter we looked forward to come last sunday~為什么to的后面是come而不是coming~
- 若直線y=kx+3與直線y=1/kx-5的交點在直線y=x上,則k=
- 車棚里停著三輪車和自行車一共10輛,一共有24個輪子.三輪車和自行車各有多少輛?(調(diào)整假設(shè),列表解答) 假設(shè)三輪車的輛數(shù) 相應的自行車的輛數(shù) 輪子總個數(shù) 5 5
- 我的英語老師唱歌唱得好 My english teacher---- -----
猜你喜歡
- 11/2+3/4+7/8+15/16簡算
- 2英語翻譯
- 3104.79用英文怎么表達
- 4已知,p:2x^2-9x+a
- 5英文達人來幫忙解釋下.
- 6求函數(shù)y=(lnx)^1/X微分dx
- 7已知拋物線y=x²-x+a與x軸的兩個交點之間的距離為√5.第一象限內(nèi)的點A在拋物線上,且點A的縱坐標為1
- 8AB距31km,甲從A到B,一小時后乙也從A地去B地.已知甲每時行12千米,乙每時行28km.乙0.75h追上甲
- 9雙重否定句怎么改
- 10有一吊車,纏繞其上的鋼絲繩的最大承受力為10^3牛,次吊車能否勻速提升重為2.8×10^3牛的小轎車要公式
- 11已知直線L與直線y=-2x+8的交點橫坐標為2,與直線y=-2x-8的交點縱坐標為7,求直線L解析式.
- 12六(1)班男生人數(shù)的五分之二等于女生的七分之四,男生比女生多9人,這個班有多少人?