B - B 圆周率用acos(-1.0) 使用longlong
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1305 uDebug
Description
A parallelogram is a quadrilateral with two pairs of parallel sides. See the picture below:
Fig: a parallelogram
Now you are given the co ordinates of A, B and C, you have to find the coordinates of D and the area of the parallelogram. The orientation of ABCDshould be same as in the picture.
Input
Input starts with an integer T (≤ 1000), denoting the number of test cases.
Each case starts with a line containing six integers Ax, Ay, Bx, By, Cx, Cy where (Ax, Ay) denotes the coordinate of A, (Bx, By) denotes the coordinate of B and (Cx, Cy) denotes the coordinate of C. Value of any coordinate lies in the range [-1000, 1000]. And you can assume that A, B andC will not be collinear.
Output
For each case, print the case number and three integers where the first two should be the coordinate of D and the third one should be the area of the parallelogram.
Sample Input
3
0 0 10 0 10 10
0 0 10 0 10 -20
-12 -10 21 21 1 40
Sample Output
Case 1: 0 10 100
Case 2: 0 -20 200
Case 3: -32 9 1247
向量叉积求平行四边形的面积---
代码:
F - F 圆周率用acos(-1.0) 使用longlong
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1331 uDebug
Description
Agent J is preparing to steal an antique diamond piece from a museum. As it is fully guarded and they are guarding it using high technologies, it's not easy to steal the piece. There are three circular laser scanners in the museum which are the main headache for Agent J. The scanners are centered in a certain position, and they keep rotating maintaining a certain radius. And they are placed such that their coverage areas touch each other as shown in the picture below:
Here R1, R2 and R3 are the radii of the coverage areas of the three laser scanners. The diamond is placed in the place blue shaded region as in the picture. Now your task is to find the area of this region for Agent J, as he needs to know where he should land to steal the diamond.
Input
Input starts with an integer T (≤ 1000), denoting the number of test cases.
Each case starts with a line containing three real numbers denoting R1, R2 and R3 (0 < R1, R2, R3 ≤ 100). And no number contains more than two digits after the decimal point.
Output
For each case, print the case number and the area of the place where the diamond piece is located. Error less than 10-6 will be ignored.
Sample Input
3
1.0 1.0 1.0
2 2 2
3 3 3
Sample Output
Case 1: 0.16125448
Case 2: 0.645017923
Case 3: 1.4512903270
三角形的三边求面积---然后根据面积和边求角----
阴影面积=三角形面积-三个扇形面积
代码:
I - I 圆周率用acos(-1.0) 使用longlong
Time Limit:500MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1189 uDebug
Description
Given an integer n, you have to find whether it can be expressed as summation of factorials. For given n, you have to report a solution such that
n = x1! + x2! + ... + xn! (xi < xj for all i < j)
Input
Input starts with an integer T (≤ 10000), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 1018).
Output
For each case, print the case number and the solution in summation of factorial form. If there is no solution then print 'impossible'. There can be multiple solutions, any valid one will do. See the samples for exact formatting.
Sample Input
4
7
7
9
11
Sample Output
Case 1: 1!+3!
Case 2: 0!+3!
Case 3: 1!+2!+3!
Case 4: impossible
Hint
Be careful about the output format; you may get wrong answer for wrong output format.
Problem Setter: Jane Alam Jan
Developed and Maintained by | Copyright © 2012 |
打个N!的表---打到19就行了
然后能取大的就取打的------因为每项相差几倍----N!>(1!+2!+...+(N-1)!)
代码:
J - J 圆周率用acos(-1.0) 使用longlong
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1307 uDebug
Description
You are given N sticks having distinct lengths; you have to form some triangles using the sticks. A triangle is valid if its area is positive. Your task is to find the number of ways you can form a valid triangle using the sticks.
Input
Input starts with an integer T (≤ 10), denoting the number of test cases.
Each case starts with a line containing an integer N (3 ≤ N ≤ 2000). The next line contains N integers denoting the lengths of the sticks. You can assume that the lengths are distinct and each length lies in the range [1, 109].
Output
For each case, print the case number and the total number of ways a valid triangle can be formed.
Sample Input
3
5
3 12 5 4 9
6
1 2 3 4 5 6
4
100 211 212 121
Sample Output
Case 1: 3
Case 2: 7
Case 3: 4
确定两边---然后二分查找两边之和的位置----中间的为第三边的个数(边从小到大----)
代码:
K - AK前十道后,AC本题才有积分
Time Limit:500MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1047 uDebug
Description
The people of Mohammadpur have decided to paint each of their houses red, green, or blue. They've also decided that no two neighboring houses will be painted the same color. The neighbors of house i are houses i-1 and i+1. The first and last houses are not neighbors.
You will be given the information of houses. Each house will contain three integers "R G B" (quotes for clarity only), where R, G and B are the costs of painting the corresponding house red, green, and blue, respectively. Return the minimal total cost required to perform the work.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case begins with a blank line and an integer n (1 ≤ n ≤ 20) denoting the number of houses. Each of the next n lines will contain 3 integers "R G B". These integers will lie in the range [1, 1000].
Output
For each case of input you have to print the case number and the minimal cost.
Sample Input
2
4
13 23 12
77 36 64
44 89 76
31 78 45
3
26 40 83
49 60 57
13 89 99
Sample Output
Case 1: 137
Case 2: 96
代码:
M - AK前十道后,AC本题才有积分
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1064 uDebug
Description
n common cubic dice are thrown. What is the probability that the sum of all thrown dice is at least x?
Input
Input starts with an integer T (≤ 200), denoting the number of test cases.
Each test case contains two integers n (1 ≤ n < 25) and x (0 ≤ x < 150). The meanings of n and x are given in the problem statement.
Output
For each case, output the case number and the probability in 'p/q' form where p and q are relatively prime. If q equals 1 then print p only.
Sample Input
7
3 9
1 7
24 24
15 76
24 143
23 81
7 38
Sample Output
Case 1: 20/27
Case 2: 0
Case 3: 1
Case 4: 11703055/78364164096
Case 5: 25/4738381338321616896
Case 6: 1/2
Case 7: 55/46656
代码:
N - AK前十道后,AC本题才有积分
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ 1122 uDebug
Description
Given a set of digits S, and an integer n, you have to find how many n-digit integers are there, which contain digits that belong to S and the difference between any two adjacent digits is not more than two.
Input
Input starts with an integer T (≤ 300), denoting the number of test cases.
Each case contains two integers, m (1 ≤ m < 10) and n (1 ≤ n ≤ 10). The next line will contain m integers (from 1 to 9) separated by spaces. These integers form the set S as described above. These integers will be distinct and given in ascending order.
Output
For each case, print the case number and the number of valid n-digit integers in a single line.
Sample Input
3
3 2
1 3 6
3 2
1 2 3
3 3
1 4 6
Sample Output
Case 1: 5
Case 2: 9
Case 3: 9
Hint
For the first case the valid integers are
11
13
31
33
66
Problem Setter: Jane Alam Jan
Developed and Maintained by | Copyright © 2012 |
代码: