промежутое

This commit is contained in:
2025-12-05 11:48:13 +05:00
parent 30647281a5
commit dcb80ef973
48 changed files with 1190 additions and 0 deletions

37
programm/Lucky_ticket2.py Normal file
View File

@@ -0,0 +1,37 @@
def digital_root(num_str):
"""Вычисляет цифровой корень числа"""
total = sum(int(digit) for digit in num_str)
while total >= 10:
total = sum(int(digit) for digit in str(total))
return total
def is_lucky_ticket(ticket):
n = len(ticket)
for i in range(1, n):
left_part = ticket[:i]
right_part = ticket[i:]
left_root = digital_root(left_part)
right_root = digital_root(right_part)
if left_root == right_root:
return True
return False
with open('INPUT.TXT', 'r') as f:
ticket_number = f.read().strip()
if is_lucky_ticket(ticket_number):
result = "YES"
else:
result = "NO"
with open('OUTPUT.TXT', 'w') as f:
f.write(result)

Binary file not shown.

58
programm/bubble.py Normal file
View File

@@ -0,0 +1,58 @@
import random
def create():
l = []
for i in range(10):
a = random.randint(0,100)
l.append(a)
debug(l)
return l
def len(mass):
temp=0
for i,j in enumerate(mass):
temp+=1
return temp
def max(mass):
temp=0
for i,j in enumerate(mass):
if temp<j:
temp=j
return temp
def sort(mass):
temp_mass = mass
len_mass = len(mass=temp_mass)
max_int=max(temp_mass)
while True:
temp=0
for i,j in enumerate(temp_mass):
if i+1<len_mass:
if temp_mass[i] < temp_mass[i+1]:
temp+=1
if temp == len_mass-1:
return temp_mass
for i in range(len_mass):
if i+1<len_mass:
if temp_mass[i] < temp_mass[i+1]:
pass
else:
temp = temp_mass[i]
temp_mass[i] = temp_mass[i+1]
temp_mass[i+1]= temp
def debug(mass):
print(f"{mass=}")
def programm():
mass=create()
sort(mass=mass)
debug(mass=mass)
programm()

View File

@@ -0,0 +1,28 @@
import turtle as t
from math import*
import tqdm as tq
t.color('red', 'yellow')
t.begin_fill()
t.shapesize()
t.resizemode('user')
t.shapesize(1,1,0.1)
def load_normalaze():
t.setx(-100)
t.setx(100)
t.setx(0)
t.sety(100)
t.sety(-100)
t.sety(0)
load_normalaze()
for i in tq.tqdm(range(100), ncols=80):
t.setx(i)
t.sety(sin(i)*30)
t.end_fill()
t.done()