| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 7650 | PA - Kerker V.S. Rational number |
|
| 7651 | PB - ASCII Morning II |
|
| 7652 | PC - ETag makes life easier |
|
| 7653 | PD - Pick Up Thumbtacks |
|
| 7654 | PE - 交換次數 |
|
Description
Kerker最喜歡小妹妹了>////<最近有個可愛的妹妹正在學分數,可是她常常在數字前面加上很多空白或是多餘的0,就連數字的中間也會有空白!例如把"3010"寫成"00 03 010",只是碰到這麼可愛的妹妹,Kerker當然不忍心責備她,所以他要求你把幫小妹妹把數字寫成正常的樣子。
Input
第一列有一個數字t,代表測資數目。接著有t組測資,每組測資四列。第一列為分子,第二列為分線(長度至少為3),第三列為分母,第四列為空白列。分子和分母的前後及中間都可能夾雜著多個0和空白,但至少會有一個數字,不會全部為空白。
第一和第三列只會出現數字和空白
第二列只會出現'-'
每列的長度(含數字、空白和'-')不超過100個字元
Output
每組測資輸出一列,格式為"分子/分母",分子和分母前面不得有多餘的0和空白,後面也不得有多餘的空白。請參考sample output。
Sample Input Download
Sample Output Download
Tags
Discuss
Description
We are trying to construct a labyrinth on a board of size m × n. Initially, on each square of the board we find a piece of thin plywood of size 1 × 1 with one of the following three patterns painted on it.
+---+ +---+ +---+
| | | | | |
| | |** | |***|
| | | * | | |
+---+ +---+ +---+
Type1 Type2 Type3
Now, your task is easy!!
You need to count how many number of type 3 in the labyrinth!
Input
The first line of input contains a number c giving the number of cases that follow. The test data for each case start with two numbers m and n giving the number of rows and columns on the board. The remaining lines form an ASCII rendition of the initial board with the pieces placed on squares. The characters used in the rendition are +, -, |, * and space. See the sample input for the format. The size of the input board will be such that m , n ≤ 64.
Output
For each case print in a single line how many number of type 3.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
遠通電收在國道上佈下了天羅地網,目的就是為台灣人民服務(?)。
但近來發現門架故障率越來越高,使得營收的一大部分都得拿去維修門架。
已知一個門架的維修的成本為維修總站與門架的距離平方,
亦即假如維修總站的所在位置為Xstation,門架的位置為Xgate,
那麼此門架的維修成本將為(Xstation-Xgate)2
不堪虧損的遠通拜託你幫他在國道上找尋一個地點設為維修總站,
使得所有門架的維修成本和為最小。
儘管你很不願意,但身為一個善良的工程師,還是幫幫可憐的遠通吧。
Input
輸入的第一列有一個整數 t (0 < t < 10) 代表以下有多少組測試資料。
每組測試資料一列,第一個整數 r(0 < r <= 1000000),代表門架的數目。接下來的r個整數g1,g2,......gr為這些門架在國道上的位置(0 <= gi <= 500)。
注意:同一個位置可能會有許多門架(重複扣款嘛)。
Output
單行輸出兩個整數,以空白分隔,分別代表最小的維修成本和以及維修總站所在的位置。
(如果有多個位置皆能最小化維修成本和,請輸出最小的那個)
Sample Input Download
Sample Output Download
Tags
Discuss
Description
有一天,呆羊不小心把M個圖釘灑到地上,
為了避免有人踩到圖釘,他必須把掉在地上的圖釘清理乾淨,
由於一個一個撿起來實在太慢了,所以他決定用一個強力磁鐵來吸住它們。
但是現在有個問題,由於圖釘實在太多了,
呆羊想知道圖釘們會以怎樣的順序接近他,以免被圖釘刺到。
現在,給定一個二維座標,以及呆羊和圖釘們的座標,請你寫一個程式,按照順序給出被磁鐵吸住的圖釘。
Input
第一行有一整數T,代表測試資料的組數,每筆測資有多行。
對於每筆測資,第一行會有兩個整數x0,y0,代表呆羊的座標。
第二行有一個正整數M,表示圖釘的總數量。
接下來M行,每行各有兩個整數xi,yi,代表第i個圖釘的座標。
圖釘的編號為1~M。
1<=M<=1000
-1000<=x0~M,y0~M<=1000
Hint:距離磁鐵較近的圖釘會先被磁鐵吸引。
Output
對於每筆測資,按照題目要求輸出圖釘的標號與位置,輸出格式請參考sample output。
如果有兩顆圖釘同時到達,那麼輸出編號較小的那一個。
每筆測資間請空一行。