ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 11.01.2024

Просмотров: 52

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.


print(sum_kn(c,d))

[10:08, 02.07.2022] +7 747 223 5788: # 69-bet

# 1-misol

#3-usul

def sum_kn(k,n): # 15,16,17,18,...,42,43,44,45=(15+45)*15+30=900+30=930

# s=(n+k)*(n-k+1)//2

sab=s=(n+k)*(n-k+1)//2

return sab

a,b=map(int,input().split())

c,d=map(int,input().split())

print(sum_kn(a,b))

print(sum_kn(c,d))

[10:21, 02.07.2022] +7 747 223 5788: # 69-bet

# 2-misol

def masofa(x1,y1,x2,y2):

d=((x2-x1)*2+(y2-y1)2)*0.5

return round(d,1)

x1,y1=map(int,input().split())

x2,y2=map(int,input().split())

x3,y3=map(int,input().split())

print(masofa(x1,y1,x2,y2))

print(masofa(x1,y1,x3,y3))

print(masofa(x3,y3,x2,y2))

[10:27, 02.07.2022] +7 747 223 5788: # 69-bet

#3-misol

# factorial

# 0!=1

# 1!=1

# 2!=1*2=2

# 3!=1*2*3=6

# 4!=1*2*3*4=24

# 5!=1*2*3*4*5=120

# ...

def factorial(n):

p=1

for i in range(1,n+1):

p=p*i

return p

n=int(input())

print(factorial(n))

[10:28, 02.07.2022] +7 747 223 5788: def factorial(n):

if n==0:

return 1

else:

p=1

for i in range(1,n+1):

p=p*i

return p

n=int(input())

print(factorial(n))

[10:30, 02.07.2022] +7 747 223 5788: # 2-usul

import math

n=int(input())

print(math.factorial(n))

[10:35, 02.07.2022] +7 747 223 5788: '''

# 70-bet

# 4-top

# 1-usul

def sakkizlik(n):

s=''

while n>0:

d=n%8

n=n//8

s=str(d)+s

print(s)

a,b=map(int,input().split())

sakkizlik(a)

sakkizlik(b)

'''

'''

# 70-bet

# 4-top

# 2-usul

def sakkizlik(n):

s=0

p=1

while n>0:

d=n%8

n=n//8

s=s+d*p

p=p*10

print(s)

a,b=map(int,input().split())

sakkizlik(a)

sakkizlik(b)

'''

'''

# 65-bet

# 3-usul

def sakkizlik(n):

s=oct(n)

print(s[2:])

a,b=map(int,input().split())

sakkizlik(a)

sakkizlik(b)

'''

[10:57, 02.07.2022] +7 747 223 5788: '''

# 70-bet

# 5-top

# ekub(a,b) -- a va b sonlarining eng katta umumiy bo'luvchisi

# evklid algoritmi

# a=32 b=48

# 48-32=16

# b=32 a=16

# 32-16=16 a=16 b=16

# 16-16=0 a=0 b=16 javob 16

# a=16 b=97

# 97-16=81 b=81 a=16

# 81-16=65 b=65 a=16

# 65-16=49 b=49 a=16

# 49-16=33 b=33 a=16

# 33-16=17 b=17 a=16

# 17-16=1 b=1 a=16

# 16-1=15 a=15 b=1

...

# 2-1=1 a=1 b=1

# 1-1=0 a=0 b=1 Javob 1

# kengaytirilgan evklid algoritmi

# 48%32=16 b=32 a=16

# 32%16=0

# 97%16=1

# 16%1=0

def ekub(a,b): # a>b a=5 b=10 t=5 a=10 b=5

while b!=0:

t=a%b

a=b

b=t

return a

a,b=map(int,input().split())

print(ekub(a,b))

'''

[11:18, 02.07.2022] +7 747 223 5788: # 70-bet

# 5-misol

# 2-usul

import math

a,b=map(int,input().split())

print(math.gcd(a,b))

[11:20, 02.07.2022] +7 747 223 5788: # 70-bet

# 5-misol

# 2-usul

import math

a,b=map(int,input().split())

print(math.gcd(a,b)) # gcd -- greatest common divisor -ekub(a,b) -- a va b sonlarining eng katta umumiy bo'luvchisi

[11:33, 02.07.2022] +7 747 223 5788: '''

# 70-bet 6-topshiriq

def nollar_soni(k):

return str(k).count('0')

n=int(input())

mx=-1

a=[0]*n

ind=0

for i in range(n):

a[i]=int(input())

if nollar_soni(a[i])>mx:

mx=nollar_soni(a[i])

ind=i

print(a[ind])

5

5

3256

1003

50056

1850

1003

3

123

456

789

123

5

10003

20003

200056565665

12000454545

1200012122112

10003

'''

[11:38, 02.07.2022] +7 747 223 5788: # 70-bet 6-topshiriq

# 2-usul // %

def nollar_soni(k):

count_zero=0

while k>0:

d=k%10 # k=123456 d=6

k=k//10 # k=12345

if d==0:

count_zero+=1

return count_zero

n=int(input())

mx=-1

a=[0]*n


ind=0

for i in range(n):

a[i]=int(input())

if nollar_soni(a[i])>mx:

mx=nollar_soni(a[i])

ind=i

print(a[ind])

[11:55, 02.07.2022] +7 747 223 5788: # 70-bet ekoe - eng kishi ortaq eselik

# ekuk - eng kichik umumiy karrali

# nok - наименьшее общее кратное

# 5 ning karralilari yoki 5 ga bo'linadigan sonlar: 5 10 15 20 25 30 35 40 45 50 55 ...

# 9 va 12

# 9 ning karralilari: 9 18 27 36 45 54 63 72 81 90 99 108

# 12 ning karralilari: 12 24 36 48 60 72 84 96 108

# 9 va 12 ning umumiy karralilari: 36,72,108,...

# 9 va 12 ning eng kichik umumiy karralisi -- 36

# nod*nok=a*b

# a=9 va b=12

# nok=36

# nod=3

# 3*36=108

# a*b=9*12=108

# *************** nok=a*b//nod ** FORMULA

def ekub(a,b): # a>b a=5 b=10 t=5 a=10 b=5

while b!=0:

t=a%b

a=b

b=t

return a

a,b=map(int,input().split())

print(a*b//ekub(a,b))

9 12

36

5 4

20

[12:02, 02.07.2022] +7 747 223 5788: # 70-bet

# 7-topshiriq

# 2-usul

import math

a,b=map(int,input().split())

print(a*b//math.gcd(a,b))

# lcm -- Least Common Multiple

[12:20, 02.07.2022] +7 747 223 5788: def sum_digits(n):

sum=n%10

if n>=10:

sum=sum+sum_digits(n//10)

return sum

k=int(input())

print(sum_digits(k))

# FIFO (First-In-First-Out) -- биринчи кирган охирги чикади -- стек

123

6

9

9

45788778454513111455458778

132

[12:21, 02.07.2022] +7 747 223 5788: '''

# *********** RECURSIYA *******

# RECURSIYA -- o'zini o'zi chaqiradigan funksiya

# 72-bet 2-kod

# sonning raqamlarining yig'indisini topish kerak

# masalan, n=123456789000000000000000000, s=45


# masalan, n=45788778454513111455458778, s=???

# masalan,n=4 s=4

# n=9 s=9

# n=3 s=3

def sum_digits(n):

sum=n%10

if n>=10:

sum=sum+sum_digits(n//10)

return sum

k=int(input())

print(sum_digits(k))

# FIFO (First-In-First-Out) -- биринчи кирган охирги чикади -- стек

123

6

9

9

45788778454513111455458778

132

'''

[12:30, 02.07.2022] +7 747 223 5788: # 72 - bet

# 1-kod

def fib(p,q): # p,q,t

global i,n

t=p+q

i=i+1

print(t,end=' ')

if i
fib(q,t)

n=int(input('n>=2'))

x=1

y=1

print(1,1,end=' ')

i=1

fib(1,1)

n>=2 10

1 1 2 3 5 8 13 21 34 55 89

[12:37, 02.07.2022] +7 747 223 5788: # 74-bet 1-topshiriq

# factorial rekursiya bilan

# factorial

# 0!=1 -- ta'rif bo'yicha

# 1!=1=0!*1

# 2!=1*2=2=1!*2

# 3!=1*2*3=6=2!*3

# 4!=1*2*3*4=24=3!*4

# 5!=1*2*3*4*5=120=4!*5

# 6!=1*2*3*4*5*6=720=5!*6

# 7!=1*2*3*4*5*6*7=5040=6!7 n=n(n-1)!

def fact(n):

if n==0:

return 1

else:

return n*fact(n-1)

n=int(input())

print(fact(n))

# 74-bet

# 2-top

a1,d,n=map(int,input().split())

an=a1+(n-1)*d

sn=(a1+an)*n//2

print(an)

print(sn)

2 2 5

10

30

2 2+2=4 4+2=6 6+2=8 8+2=10 a5=10

s5=2+4+6+8+10=30



Фибоначчи сонларини шундоқ ёзсак, тушунарлироқ бўлар экан.