1 1 2 2 3 3 n n công thức Chương trình Python

45. There are two circles C1 with radius r1, central coordinate [x1, y1] and C2 with radius r2 and central coordinate [x2, y2].

Write a Python program to test the followings -

  • "C2 is in C1" if C2 is in C1
  • "C1 is in C2" if C1 is in C2
  • "Circumference of C1 and C2 intersect" if circumference of C1 and C2 intersect
  • "C1 and C2 do not overlap" if C1 and C2 do not overlap and
  • "Circumference of C1 and C2 will touch" if C1 and C2 touch
Input
Input numbers [real numbers] are separated by a space
Input x1, y1, r1, x2, y2, r2
5 4 2 3 9 2
C1 and C2 do not overlap
Input x1, y1, r1, x2, y2, r2
5 4 3 5 10 3
Chu vi của C1 và C2 sẽ chạm nhau
Input x1, y1, r1, x2, y2, r2
6 4 3 10 4 2
Circumference of C1 and C2 intersect
Input x1, y1, r1, x2, y2, r2
5 4 3 5 4 2
C2 is in C1
Input x1, y1, r1, x2, y2, r2
5 4 2 5 4 3
C1 is in C2
Click me to see the sample solution

46. Write a Python program that reads a date [from 2016/1/1 to 2016/12/31] and prints the day of the date. Jan. 1, 2016, is Friday. Note that 2016 is a leap year.
Input
Two integers m and d separated by a single space in a line, m ,d represent the month and the day
Input month and date [separated by a single space]
5 15
Name of the date. Sunday
Click me to see the sample solution

47. Write a Python program that reads text [only alphabetical characters and spaces] and prints two words. The first word is the one that appears most often in the text. The second one is the word with the most letters.

Ghi chú. A word is a sequence of letters which is separated by the spaces

Input
A text is given in a line with following condition
a. The number of letters in the text is less than or equal to 1000
b. The number of letters in a word is less than or equal to 32
c. There is only one word which is arise most frequently in given text
d. There is only one word which has the maximum number of letters in given text
Input text. Thank you for your comment and your participation
Output. your participation
Click me to see the sample solution

48. Write a Python program that reads n digits [given] chosen from 0 to 9 and prints the number of combinations where the sum of the digits equals another given number [s]. Do not use the same digits in a combination.
Input
Two integers as number of combinations and their sum by a single space in a line. Input 0 0 to exit
Input number of combinations and sum, input 0 0 to exit
5 6
2 4
0 0
2
Click me to see the sample solution

49. Write a Python program that reads the two adjoining sides and the diagonal of a parallelogram and checks whether the parallelogram is a rectangle or a rhombus.
According to Wikipedia-
parallelograms. In Euclidean geometry, a parallelogram is a simple [non-self-intersecting] quadrilateral with two pairs of parallel sides. The opposite or facing sides of a parallelogram are of equal length and the opposite angles of a parallelogram are of equal measure
rectangles. In Euclidean plane geometry, a rectangle is a quadrilateral with four right angles. It can also be defined as an equiangular quadrilateral, since equiangular means that all of its angles are equal [360°/4 = 90°]. It can also be defined as a parallelogram containing a right angle
rhombus. In plane Euclidean geometry, a rhombus [plural rhombi or rhombuses] is a simple [non-self-intersecting] quadrilateral whose four sides all have the same length. Another name is equilateral quadrilateral, since equilateral means that all of its sides are equal in length. The rhombus is often called a diamond, after the diamonds suit in playing cards which resembles the projection of an octahedral diamond, or a lozenge, though the former sometimes refers specifically to a rhombus with a 60° angle, and the latter sometimes refers specifically to a rhombus with a 45° angle
Input
Two adjoined sides and the diagonal
1

Chủ Đề