171 - 基礎班Quiz1 Round1 Scoreboard

Time

2014/02/27 19:10:00 2014/02/27 20:45:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

7645 - PA - Cake V.S. Rational number   

Description

蛋糕是個有條理(龜毛)的人,每次寫分數時都一定要寫得整整齊齊,連分線長度都要畫得跟數字長度一樣長,而且堅持把數字寫在分線的中間。給你分子和分母,你能幫助他輸出工工整整的分數嗎?

Input

第一列有一數字t, 代表測資數量。接下來t列,每列有兩個數字x,y,分別代表分子和分母。

t<=50

x,y為長度不超過15位數的非負整數,且開頭不會有多餘的0(不會出現00002, 034, 012...)

 

Output

每組測資輸出三列,第一列為分子,第二列為分線,第三列為分母。每組測資後請輸出一列空白列。

分線的長度要等於x,y兩者較長的那個的長度,並且x,y中較短的那個數要對齊分線的中間(也就是必要時要在前面補上空白),例如:x的長度為3, y的長度為5,則分線長度為max(3,5)=5,短的要對齊分線的中間,所以x前面必須要有1個空白。每組測資短的數字的長度必剛好可以對齊分線中間。請參考sample output。

特別注意:行末不得有空白。
 

Sample Input  Download

Sample Output  Download

Tags




Discuss




7646 - PB - ASCII Morning   

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 2 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 2.

Sample Input  Download

Sample Output  Download

Tags




Discuss




7647 - PC - ETag's hard problem   

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




7648 - PD - Mine Threat   

Description

前年,NTHU派出了一些選手到越南參加ACM-ICPC預選賽,但是他們一群人卻不幸誤闖了地雷區,
導致他們都不敢隨意亂動,否則很可能會被炸死T_T。
好在你身處台灣,而且你掌握了那個地雷區中全部M個的地雷位置,
並且擁有地雷和選手們所在的座標位置。
現在,在2D座標軸上,給定你選手們和所有地雷的座標,請你按照順序,
將地雷離選手的距離遠到近排序,並輸出地雷的編號和座標。

Input

第一行有一整數T,代表測試資料的組數,每筆測資有多行。
對於每筆測資,第一行會有兩個整數x0,y0,代表NTHU選手的座標。
第二行有一個正整數M,表示地雷的總數量。
接下來M行,每行各有兩個整數xi,yi,代表第i個地雷的座標。
地雷的編號為1~M。

1<=M<=1000
-1000<=x0~M,y0~M<=1000

Output

對於每筆測資,按照題目要求輸出地雷標號與位置,輸出格式請參考sample output。
如果有兩顆地雷的距離相等,則先輸出編號較小的那一個。
每筆測資間請空一行。

Sample Input  Download

Sample Output  Download

Tags




Discuss




7649 - PE - 逆序數對   

Description

設 A 為一個有 n 個數字的序列。
如果存在正整數 i, j 使得 1 ≤ i < j ≤ n 而且 A[i] > A[j],則稱他們為一個逆序數對

Input

多筆測資
每筆測資兩行
第一行為一正整數n
第二行n個數字,表示A序列
以EOF結束輸入

所有數字皆可存於32bit signed integer(ex: int in C++)
n<=106

Output

每筆測資輸出一行一個數字:A的逆序數對的個數

Sample Input  Download

Sample Output  Download

Tags




Discuss




9999 - MultiTest   

Description

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss