103 - 100學年上學期第二次程式檢定 Scoreboard

Time

2011/11/23 19:05:00 2011/11/23 22:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
9124 Power
9128 Alphabetically order
9132 Connected Component
9136 Empty Circumcircle Problem
9140 Minimum Product Spanning Tree

9124 - Power   

Description

Compute ab for the given integers a and b.

Input

The first line of input contains a positive integer t (t <= 100), which indicates the number of test cases.  For each case, there are two positive integers a, b in a line (a ,b < 250).

Output

For each test case, output in a single line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9128 - Alphabetically order   

Description

Given two strings, output them in alphabetical order.
Note: the order is AaBbCcDd ... YyZz.

Input

The first line of input contains a positive integer t (t <= 10000), which indicates the number of test cases. For each case a line, there are two strings separated by a single space. The lengths of the strings are no more than 10000.

Output

For each case a line, output the two strings in alphabetical order, separated by a single space.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9132 - Connected Component   

Description

Given an undirected graph with several connected components, find the one with the largest number of nodes. A connected component is a subset of nodes in which any two nodes are connected to each other by paths, and which is connected to no additional nodes.

Input

There will be several test cases. In each test case, the first line will be an integer N ( 0 < N <= 100000 ) representing the number of nodes. The second line contains an integer K(0<=K<=1000000) which is the number of edges. In the next K lines, each line contains two integers, A and B ( 0 <= A, B < N ), which are two end nodes of an undirected edge. If N = 0, the input ends.

Output

For each graph, print the number of nodes for the largest connected component.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9136 - Empty Circumcircle Problem   

Description

Given a triangle and a point p, check whether the interior of the circumcircle of the triangle is empty or it contains the point p. If the interior of the circumcircle of the triangle is empty, then output “yes”; otherwise, output “no”. A circumcircle center of a triangle is a point whose distances to the three points of the triangle are the same. The coordinates of all input points are integers. However, the center of the circumcircle can be general real numbers.

Notice: If point p is on the boundary of the circumcircle, it should be consider inside the circumcircle.

Input

The input contains several test cases. In each test case, there are eight integers representing the three coordinates of a triangle and the point p on a 2D plane. All the input integers are ranged from -10000 to 10000. You can assume that the area of the triangle is greater than 0.

Output

For each test case, print whether the corresponding circumcircle is empty. If it is empty, then print “yes”; otherwise, print “no”.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9140 - Minimum Product Spanning Tree   

Description

A spanning tree of a graph G = (V, E) is a subset of edges from E that forms a tree connecting all vertices of V. Suppose that G is edge-weighted and all edge weights are positive. Then a minimum product spanning tree of G is defined to be a spanning tree of G that minimizes the product of tree edge weights. Given an edge-weighted graph as shown in Figure 1, for example, the tree shown in Figure 2 is a minimum product spanning tree of this graph. Please write a program to show a minimum product spanning tree of a given edge-weighted graph. In order to make the answer fits in reasonable space, we ask only the natural logarithm of the weight of the spanning tree.


Figure 1: An edge-weighted graph whose weights are positive.

Figure 2: A minimum product spanning tree of the edge-weighted graph as shown in Figure 1.

Input

The input file contains multiple test cases. Each case begins with a line of two integers n (2 ≤ n ≤ 100) and m (1 ≤ m ≤ 4950), where n is the number of vertices and m is the number of edges in the graph. After that, there are m lines each containing three integers u, v and w (1 ≤ u, vn, uv, 0 < w ≤ 214) describing an edge of weight w connecting vertices u and v. You may assume that no two vertices are directly connected by more than one edge, and the given graph is connected. There is a blank line between two successive cases, and the input is terminated by end-of-file.

Output

For each case, print “Case i: d” in a line, where i is the test case number starting from 1, and d is the natural logarithm of the product of edge weights in a minimum product spanning tree, rounded to 2 digits after the decimal point. You may assume that the accumulated floating point error would not cause difference to the printed answer. Note that there is a single space character before i and d.

Hint

To calculate the natural logarithm of a number, you may use the “log” function by including (or in C++). There are 3 versions of this function:

double log ( double x );
float log ( float x );
long double log ( long double x );

This function receives a floating point number x as parameter, and return the natural logarithm of x. Note that in C, only the double version of this function exists with this name.

Sample Input  Download

Sample Output  Download

Tags




Discuss