Input: M Is The Number of Lights .The Last Test Case Is Followed by A Line Containing Three Zeros
Input: M Is The Number of Lights .The Last Test Case Is Followed by A Line Containing Three Zeros
Input: M Is The Number of Lights .The Last Test Case Is Followed by A Line Containing Three Zeros
The first student goes alone the lights from left to right and pull the switch lines which control
those lights coded by the multiple of 1. Then the second student goes alone the lights from left to
right and pull the switch lines which control those lights coded by the multiple of 2 . Then the
third student goes alone the lights from left to right and pull the switch lines which control those
lights coded by the multiple of 3 . By this way, we can draw a conclusion is that , in the last
situation , the M student go alone the lights from left to right and pull the switch lines which
control those lights coded by the multiple of M. Then ,Min has a problem, after the experiment,
how much lights is turning on from the a-th light to the b-th light?
Input
There many cases. Each test case consists of three integer M (1 ≤ M ≤ 106), a,b (0 < a ≤ b ≤ M),
M is the number of lights .The last test case is followed by a line containing three zeros .
Output
Sample Input
5 1 3
8 4 7
0 0 0
Sample Output
1
1
What matters most is that which patterns are the dominating patterns. Dominating pattern is the
pattern whose appearing times is not less than other patterns.
It is your job to find the dominating pattern(s) and their appearing times.
Input
The entire input contains multi cases. The first line of each case is an integer, which is the
number of patterns N, 1 ≤ N ≤ 150. Each of the following N lines contains one pattern, whose
length is in range [1, 70]. The rest of the case is one line contains a large string as the text to
lookup, whose length is up to 106. At the end of the input file, number ‘0’ indicates the end of
input file.
Output
For each of the input cases, output the appearing times of the dominating pattern(s). If there are
more than one dominating pattern, output them in separate lines; and keep their input order to the
output.
Sample Input
2
aba
bab
ababababac
6
beta
alpha
haha
delta
dede
tata
dedeltalphahahahototatalpha
0
Sample Output
4
aba
2
alpha
haha
You're interested in writing a program to classify triangles. Triangles can be classified according
to their internal angles. If one of the internal angles is exactly 90 degrees, then that triangle is
known as a "right" triangle. If one of the internal angles is greater than 90 degrees, that triangle is
known as an "obtuse" triangle. Otherwise, all the internal angles are less than 90 degrees and the
triangle is known as an "acute" triangle.
Triangles can also be classified according to the relative lengths of their sides. In a "scalene"
triangle, all three sides have different lengths. In an "isosceles" triangle, two of the sides are of
equal length. (If all three sides have the same length, the triangle is known as an "equilateral"
triangle, but you can ignore this case since there will be no equilateral triangles in the input data.)
Your program must determine, for each set of three points, whether or not those points form a
triangle. If the three points are not distinct, or the three points are collinear, then those points do
not form a valid triangle. (Another way is to calculate the area of the triangle; valid triangles
must have non-zero area.) Otherwise, your program will classify the triangle as one of "acute",
"obtuse", or "right", and one of "isosceles" or "scalene".
Input
The first line of input gives the number of cases, N. N test cases follow. Each case is a line
formatted as
x1 y1 x2 y2 x3 y3
Limits: 1 ≤ N ≤ 100, x1, y1, x2, y2, x3, y3 will be integers. -1000 ≤ x1, y1, x2, y2, x3, y3 ≤ 1000
Output
For each test case, output one line containing "Case #x: " followed by one of these strings:
Sample Input
8
0 0 0 4 1 2
1 1 1 4 3 2
2 2 2 4 4 3
3 3 3 4 5 3
4 4 4 5 5 6
5 5 5 6 6 5
6 6 6 7 6 8
7 7 7 7 7 7
Sample Output
Case #1: isosceles obtuse triangle
Case #2: scalene acute triangle
Case #3: isosceles acute triangle
Case #4: scalene right triangle
Case #5: scalene obtuse triangle
Case #6: isosceles right triangle
Case #7: not a triangle
Case #8: not a triangle