| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 7116 | PA: Bass and kartrider |
|
| 7117 | PB: DonDon's game |
|
| 7118 | PC: Alan need a calculator |
|
| 7119 | PD: Sketch |
|
| 7120 | PE: The Dorm of NTHU |
|
Description
Bass is a student.He just done his project, so he wants to play kartrider for taking a rest. Because he wants to remind himself to play kartrider.He draw a picture of kartrider. Can you help him to print the picture?
Input
No
Output
As same as the Sample output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
DonDon wants to design a game. In this game, there are many cities and many roads.
If the road is from city A to city B, you can only walk from A to B, but not B to A.
Since the map of the game is too large, can you write a program for DonDon to test whether there is a path from A to B?
Input
The first line of the input file contains an integer indicating the number of test cases to follow.
Then a blank line follows.
For each test case:
The first line contains 1 integer N. (0 < N < 500)
Then N lines follows. Each line is a name of a city. ( 0 < the length of city name < 10 )
After the N lines, the next line contains one integer M, which is the amount of roads, and then the starting city A and the destination B.
Then M lines follows. Each line contains 2 name of city, s and f, indicating that there is a road from city s to city f.
There is an blank line after each test case.
Output
For each test case output a single line.
If there is a way from the starting city A to the destination B, output "Yes".
Otherwise, "No".
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Alan need to take a physics exam, but his calculator disappeared!! Can you help him to do a calculator??
The calculator need:
Add(+): A + B is add two number
Cut(-): A - B is number A cut numer B
Multiply(*): A * B is number A multiply B
Divide(/): A / B is number A divide B
Input
There is a formula at a line.
The input will have $ at the end.The line doesn't have to output.
|answer| < 1000000 and will be integer.
They will have a space between number and symbol.
They will not have brackets.
The number of line will less than 100.
The length of input will < 3*10^7
Output
Please output the answer of the formula.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Tom likes to paint sketch. He trys to be good at it. Being a programmer, he would like to systematically learn from masters. He turns those masterpieces into digital data and observes the lines between each other. He wants to calculate the slopes of the lines and gets a slope M which has maximum amount of lines and finds the longest line of the slope M. Tom is eager for improving his skills on sketch and stroke systhesis. Could you do him a favor?
Input
The problem input consists several cases. The first line determines how many cases there will be.
For every case, there will be a number n indicates n straight lines.
The next n lines input will have four positive integers (x1, y1, x2, y2) in order to decide a straight line.(Lines may duplicate.)
(0 < n <= 1000 and -106 <= x1, y1,x2, y2 <= 106)
Output
Print the case number first(see Sample input) and in the next line print the longest line L of the slope with maximum amount of lines. The accuracy of L is rounding to three digits to the right of the decimal point. If there are two or more slopes with the same maximum amount of number lines, choose the slope with maximum value in calculation. Print a blank line after each cases.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Natural Tiger Hug University(NTHU) is a good university in Taiwan. Their dooms are quite interesting. For example, the doom for the computer science is a tree, and whole CS students live in there. For a tree structure, there is a root of this tree. Each node except root will have a parent.
In the CS department, there are four popular girls who are called "FOUR HUN" (四夯). The four girls are quite good at finding a problem. Now in their investigation, all CS students are very lazy. If they don't go to another's room by the best way(the best way means that they go to another's room by minimum length). They will be crazy and crash the doom. To prevent this, FOUR HUN want to save the dorm!!!!!!!!!!! But they are so popular that they can't calculate the best way. So they need your help!!!!
They will model each room by numbers(1,2,....) and they will give you many queries that the distance of the rooms they want to calculate. Please give them the answer!!!
Input
The first line in the input is an integer t(t <= 20), which indicate how many cases in the input.
For each case, given an integer n(2 <= n <= 1000), which is how many rooms in CS's dorm. Next line consists of n integers, the first integer is the room on the top of room 1. The second integer is the room on the top of room 2... so on and so forth. Each road between two rooms are bidirected.
Each integer in this line are all from 1 to n, except the root, which is denoted by 0(because there is no room on the top of it). Next line will give you a integer q (q <= 999000), which indicate how many queries the four girls asked. Next q lines each line contains two integer a, b (1 <= a,b <= n, a != b), which are the questions they want to know!!
Output
For each case, output the case number as sample.
For each query, output one line with the minimum distance between two rooms.
Please refer to the sample output.