A. Mathematics 1

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Write a program that generates a series of fraction simplification problems. Each problem consists of a fraction in the form a/b, where a and b are randomly generated positive integers between 1 and 1000.

Your task is to simplify each fraction to its simplest form by dividing both the numerator and the denominator by their greatest common divisor (GCD).

Write a Python program that generates 100 fraction simplification problems.

The output file should contain a single line with the simplified fraction in the form c/d, where c and d are the numerator and denominator of the simplified fraction obtained by dividing a and b by their GCD.

Ensure that the generated fractions are in their simplest form, i.e., the GCD of a and b is 1.

Kiruvchi ma'lumotlar:

The input file should contain a single line with the fraction in the form a/b.

Chiquvchi ma'lumotlar:

The output file should contain a single line with the simplified fraction in the form c/d, where c and d are the numerator and denominator of the simplified fraction obtained by dividing a and b by their GCD.

Ensure that the generated fractions are in their simplest form, i.e., the GCD of a and b is 1.

Misollar:
# INPUT.TXT OUTPUT.TXT
1
341/788
341/788
2
774/947
774/947

B. Science

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Write a program that generates a series of element information problems. Each problem consists of an atomic number of an element, ranging from 1 to 20.

Your task is to provide information about the element corresponding to the given atomic number. The information includes the element's symbol, name, and classification (whether it is a metal or non-metal).

Write a Python program that generates 20 element information problems

Kiruvchi ma'lumotlar:

The input file should contain a single line with the atomic number of the element.

 

Chiquvchi ma'lumotlar:

The output file should contain a single line with the element's information in the format symbol:name:classification, where symbol is the chemical symbol of the element, name is the name of the element, and classification indicates whether it is a metal or non-metal.

Izoh:

Use the following mappings for atomic number and element information:

1: H: Hydrogen: non-metal
2: He: Helium: non-metal
3: Li: Lithium: metal
4: Be: Beryllium: metal
5: B: Boron: non-metal
6: C: Carbon: non-metal
7: N: Nitrogen: non-metal
8: O: Oxygen: non-metal
9: F: Fluorine: non-metal
10: Ne: Neon: non-metal
11: Na: Sodium: metal
12: Mg: Magnesium: metal
13: Al: Aluminium: non-metal
14: Si: Silicon: non-metal
15: P: Phosphorus: non-metal
16: S: Sulfur: non-metal
17: Cl: Chlorine: non-metal
18: Ar: Argon: non-metal
19: K: Potassium: metal
20: Ca: Calcium: metal

Misollar:
# INPUT.TXT OUTPUT.TXT
1
15
P:Phosphorus:non-metal
2
4
Be:Berrylium:metal

C. History

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Consider the following table that lists some notable empires in history along with their year of birth and year of death:

| Empire               | Year of Birth | Year of Death |
|----------------------|---------------|---------------|
| Roman Empire         | -27           | 476           |
| Ottoman Empire       | 1299          | 1922          |
| Mongol Empire        | 1206          | 1368          |
| British Empire       | 1583          | 1997          |
| Egyptian Empire      | 3100          | 30            |
| Inca Empire          | 1438          | 1533          |
| Byzantine Empire     | 330           | 1453          |
| Maurya Empire        | 322           | 185           |
| Aztec Empire         | 1325          | 1521          |
| Persian Empire       | 550           | 330           |
| Mughal Empire        | 1526          | 1857          |
| Greek Empire         | -336          | -146          |
| Chinese Empire       | -221          | 1912          |
| Russian Empire       | 1721          | 1917          |
| Achaemenid Empire    | 550           | 330           |
| Carthaginian Empire  | 814           | 146           |
| Holy Roman Empire    | 962           | 1806          |
| Gupta Empire         | 240           | 550           |
| Byzantine Empire     | 395           | 1453          |
| Sasanian Empire      | 224           | 651           |
Kiruvchi ma'lumotlar:

You will be given a year.

 

Chiquvchi ma'lumotlar:
Write a Python program that takes a year as input and determines which empire(s) were born or died in that year. If multiple empires match the criteria, the program should display all of them.
Misollar:
# INPUT.TXT OUTPUT.TXT
1
100
Empire(s) born or died in 100:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
The year 100 is in the middle of Egyptian Empire and Inca Empire
2
307
Empire(s) born or died in 307:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
| Gupta Empire         | 240             | 550             |
| Sasanian Empire      | 224             | 651             |
The year 307 is in the middle of Egyptian Empire and Inca Empire
The year 307 is in the middle of Maurya Empire and Aztec Empire
The year 307 is in the middle of Carthaginian Empire and Holy Roman Empire
3
1761
Empire(s) born or died in 1761:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Ottoman Empire       | 1299            | 1922            |
| British Empire       | 1583            | 1997            |
| Mughal Empire        | 1526            | 1857            |
| Chinese Empire       | -221            | 1912            |
| Russian Empire       | 1721            | 1917            |
| Holy Roman Empire    | 962             | 1806            |
4
173
Empire(s) born or died in 173:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
The year 173 is in the middle of Egyptian Empire and Inca Empire
The year 173 is in the middle of Carthaginian Empire and Holy Roman Empire
Kitob yaratilingan sana: 15-Nov-24 03:32