forked from Yesen/python_math_stat
526 lines
14 KiB
Python
526 lines
14 KiB
Python
# # мое решение задачи с программистами
|
||
# n = int(input())
|
||
# if n < 20:
|
||
# if n == 1:
|
||
# print (str(n) + ' программист')
|
||
# elif n == 2 or n == 3 or n == 4:
|
||
# print (str(n) + ' программиста')
|
||
# else:
|
||
# print (str(n) + ' программистов')
|
||
# if 19 < n < 100:
|
||
# if (int(str(n)[-1]) == 2) or (int(str(n)[-1]) == 3) or (int(str(n)[-1]) == 4):
|
||
# print (str(n) + ' программиста')
|
||
# elif int(str(n)[-1]) == 1:
|
||
# print (str(n) + ' программист')
|
||
# else:
|
||
# print (str(n) + ' программистов')
|
||
# if n > 99:
|
||
# if ((((int(str(n)[-2:])) != 12) and ((int(str(n)[-1])) == 2))) or ((((int(str(n)[-2:])) != 13) and ((int(str(n)[-1])) == 3))) or ((((int(str(n)[-2:])) != 14) and ((int(str(n)[-1])) == 4))):
|
||
# print (str(n) + ' программиста')
|
||
# elif (int(str(n)[-1]) == 1) and (int(str(n)[-2:]) != 11):
|
||
# print (str(n) + ' программист')
|
||
# else:
|
||
# print (str(n) + ' программистов')
|
||
|
||
# # Короткий вариант
|
||
# i=int(input())
|
||
# d=i%10
|
||
# h=i%100
|
||
# # if d==1 and h!=11:
|
||
# # s=""
|
||
# # elif 1<d<5 and not 11<h<15:
|
||
# # s="а"
|
||
# # else:
|
||
# # s="ов"
|
||
# # print(i," программист"+s)
|
||
|
||
|
||
# # задача с интервалами
|
||
# x = int(input())
|
||
# print ((-15 < x <= 12) or (14 < x < 17) or (19 <= x))
|
||
|
||
# # # zadachya s biletom
|
||
# bilet_num = [int(value) for value in input()]
|
||
# Sum = 0
|
||
# Sum2 = 0
|
||
# for num in bilet_num:
|
||
# Sum += (int(str(num)[0:3]))
|
||
# print (num)
|
||
# for num in bilet_num:
|
||
# print (num)
|
||
# Sum2 += (int(str(num)[3:]))
|
||
# if Sum == Sum2:
|
||
# print('Счастливый')
|
||
# else:
|
||
# print ('Обычный')
|
||
|
||
# # # задача с билетом
|
||
# bilet_num = list(int(value) for value in input())
|
||
# Sum = 0
|
||
# Sum_1 = 0
|
||
# for num in bilet_num[:3]:
|
||
# Sum = Sum + num
|
||
# for num in bilet_num[3:]:
|
||
# Sum_1 = Sum_1 + num
|
||
# if Sum == Sum_1:
|
||
# print ("Счастливый")
|
||
# else:
|
||
# print("Обычный")
|
||
|
||
# i = 0
|
||
# while i < 5:
|
||
# print('*')
|
||
# if i % 2 == 0:
|
||
# print('**')
|
||
# if i > 2:
|
||
# print('***')
|
||
# i = i + 1
|
||
|
||
# # программа, кот считывает числа с ввода и после первого введенного нуля выводит сумму полученных чисел
|
||
# a = int(input())
|
||
# s = a
|
||
# while a != 0:
|
||
# a = int(input())
|
||
# s += a
|
||
# print(s)
|
||
|
||
# a= input().split()
|
||
# Sum = 0
|
||
# for num in a:
|
||
# if num == 0:
|
||
# break
|
||
# Sum = Sum + int(num)
|
||
# print (Sum)
|
||
|
||
# Задача с пирогом и разделением по кусочкам на количесвто человек
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# if a!= b:
|
||
# if a>b:
|
||
# a -= b
|
||
# else:
|
||
# b -= a
|
||
# print (a, b)
|
||
|
||
# НОД чисел, алгоритм Евклида
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# while a!=0 and b!=0:
|
||
# if a > b:
|
||
# a = a % b
|
||
# else:
|
||
# b = b % a
|
||
# if a != 0:
|
||
# print(a)
|
||
# else:
|
||
# print (b)
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# while a > b:
|
||
# if a%b==0 and a%:
|
||
# print(a)
|
||
# break
|
||
# else:
|
||
# a+=1
|
||
# while b > a:
|
||
# if b%a==0:
|
||
# print(b)
|
||
# break
|
||
# else:
|
||
# b+=1
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# if a >b:
|
||
# while a % b != 0:
|
||
# a += 1
|
||
# if a % b ==
|
||
# else:
|
||
# print(a)
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# n = a
|
||
# m = b
|
||
# while a % b != 0:
|
||
# n = a
|
||
# n += 1
|
||
# if n % b == 0 and n % a == 0:
|
||
# print (n)
|
||
# else:
|
||
# n +=1
|
||
|
||
# print(a)
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# # if a == b:
|
||
# # print (a)
|
||
# if a>b:
|
||
# if a % b != 0:
|
||
# n = a
|
||
# while a % b != 0:
|
||
# a += 1
|
||
# if a % b == 0:
|
||
# if a%n == 0:
|
||
# else:
|
||
# print (a)
|
||
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# if a == b:
|
||
# print (a)
|
||
# if a>b:
|
||
# if a % b != 0:
|
||
# n = a
|
||
# while a % b != 0:
|
||
# a += 1
|
||
# if a % b == 0:
|
||
# if a%n != 0:
|
||
# a +=1
|
||
# else:
|
||
# print (a)
|
||
# else:
|
||
# print (a)
|
||
# if b>a:
|
||
# if b % a != 0:
|
||
# m = b
|
||
# while b % a != 0:
|
||
# b += 1
|
||
# if b % a == 0:
|
||
# if b%m != 0:
|
||
# b +=1
|
||
# else:
|
||
# print (b)
|
||
# else:
|
||
# print (b)
|
||
|
||
# a=int(input())
|
||
# b=int(input())
|
||
# n=a
|
||
# if a==b: # если оба значения (a и b) равны, выводим сразу это значение, и программа завершается.
|
||
# print(n)
|
||
# # иначе, при помощи цикла, прибавляем к одному из значений(a или b) его же значение,
|
||
# else: # а+а+... или b+b+...до тех пор, пока сумма не будет кратной введенным значениям a и b
|
||
# while n%a!=0 or n%b!=0: # ТАКОЙ способ позволяет не прерывать цикл. Ниже пояснение.
|
||
# n=n+a
|
||
# print(n)
|
||
|
||
# else:
|
||
# print(a)
|
||
# if b>a:
|
||
# if b % a != 0:
|
||
# while m % a != 0 and m % b != 0:
|
||
# m += 1
|
||
# print (m)
|
||
# else:
|
||
# print(m)
|
||
|
||
|
||
# i = input().splitlines()
|
||
# for num in i:
|
||
# print (num)
|
||
# while num > 10:
|
||
# if num < 100:
|
||
# continue
|
||
# if num > 100:
|
||
# break
|
||
|
||
|
||
# по 1 числу в строке\ если меньше 10 то пропускаем/ если число больше 100 то стоп/ остальное вывести
|
||
# i=0
|
||
# while i <= 100:
|
||
# i = int(input())
|
||
# if i < 10:
|
||
# continue
|
||
# if i>100:
|
||
# break
|
||
# else:
|
||
# print(i)
|
||
|
||
|
||
# for j in range(1):
|
||
# print ("c", end="v")
|
||
|
||
# # таблица умножения в виде таблицы
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# c = int(input())
|
||
# d = int(input())
|
||
# for num in range (c,d+1):
|
||
# print("\t"+ str(num), end="")
|
||
# print()
|
||
# for num in range (a, b+1):
|
||
# print (num,end="\t")
|
||
# for num_2 in range (c, d+1):
|
||
# print(num * num_2, end="\t")
|
||
# print()
|
||
|
||
# a = int(input())
|
||
# b = int(input())
|
||
# c = int(input())
|
||
# d = int(input())
|
||
# for num in range (c,d+1):
|
||
# # # print ('\t' + str(num), end="\t")
|
||
# # # print ("\t",str(num), sep='\t')
|
||
# print("\t" + str(num), end="")
|
||
|
||
# print()
|
||
|
||
# for num in range (a, b+1):
|
||
# print (num,end="\t")
|
||
# for num_2 in range (c, d+1):
|
||
# # # # print (num_1)
|
||
# # # m= int(num_1) * c
|
||
# # # # print (m)
|
||
# # # n= int(num_1) * d
|
||
# # # # print (n)
|
||
# # # if m == n:
|
||
# # # print (str(num_1),str(m), sep ='\t')
|
||
# # # else:
|
||
# print(num * num_2, end="\t")
|
||
# print()
|
||
|
||
# # print (num_1 + m,n,end ="\t")
|
||
# # + (m) + (n))
|
||
|
||
# a, b, c, d = int(input()), int(input()), int(input()), int(input())
|
||
|
||
# for i in range(c, d + 1):
|
||
# print("\t" + str(i), end="")
|
||
|
||
# print()
|
||
|
||
# for i in range(a, b + 1):
|
||
# print(i, end="\t")
|
||
# for n in range(c, d + 1):
|
||
# print(i * n, end="\t")
|
||
# print()
|
||
|
||
# # задача с четностью для 3
|
||
# a,b = (int(i) for i in input().split())
|
||
# # a = (int(input()))
|
||
# # b = (int(input()))
|
||
# S = 0
|
||
# len=0
|
||
# # len_range= len(range(a,b)) + 1
|
||
# for i in range (a, b+1):
|
||
# if i%3==0:
|
||
# S += i
|
||
# len+=1
|
||
# μ = S / len
|
||
# print(μ)
|
||
|
||
|
||
# # процентное соотношение
|
||
# S = input().lower()
|
||
# print (S)
|
||
# g = S.count("g")
|
||
# print (g)
|
||
# c = S.count("c")
|
||
# print (g)
|
||
# print (((int(g)+int(c))/len(S))*100)
|
||
|
||
# s = 'abcdefghijk'
|
||
# m = s[3:6]
|
||
# print (m)
|
||
# m = s[:6]
|
||
# print (m)
|
||
# m = s[3:]
|
||
# print (m)
|
||
# m = s[::-1]
|
||
# print (m)
|
||
# m = s[-3:]
|
||
# print (m)
|
||
# m = s[:-6]
|
||
# print (m)
|
||
# m = s[-1:-10:-2]
|
||
# print (m)
|
||
|
||
#учет символов в строке
|
||
# str = input()
|
||
# ind = 0
|
||
# ls =0
|
||
# for l in str:
|
||
# # n = str[0]
|
||
# # if l == n:
|
||
# # ls += 1
|
||
# # else:
|
||
# # n = str[(ls-1)]
|
||
# n=l
|
||
# if n == l:
|
||
# ind +=1
|
||
# if n!= l:\
|
||
# str = input()
|
||
# ls=0
|
||
# # for l in str:
|
||
# # letter_index= letter_index +1
|
||
# # for index,letter in enumerate(str):
|
||
# # # print (letter)
|
||
# # # print (index)
|
||
# for letter in str:
|
||
# i = str[0]
|
||
# if letter == i:
|
||
# ls = ls+1
|
||
# else:
|
||
# lm = ls - 1
|
||
|
||
|
||
# # print (i)
|
||
# print (ls-1)
|
||
|
||
|
||
# students = ['Ivan', 'Masha', 'Sasha']
|
||
# students += ['Olga']
|
||
# students += 'Olga'
|
||
# print (students)
|
||
|
||
# a = [1, 2, 3]
|
||
# b = a
|
||
# print (b)
|
||
# a[1] = 10
|
||
# print (b)
|
||
# b[0] = 20
|
||
# print (b)
|
||
# print (a)
|
||
# a = [5, 6]
|
||
# print (b)
|
||
# print (a)
|
||
|
||
# S= 0
|
||
# # for i in range(len(a)+1):
|
||
# for i in input().split():
|
||
# i = int(i)
|
||
# S += i
|
||
# # print(S)
|
||
# print(S)
|
||
|
||
|
||
# a = input().split()
|
||
# len_a = len(a) - 1
|
||
# for index, number in enumerate(a):
|
||
# if len_a == 0:
|
||
# print (number)
|
||
# else:
|
||
# if index == 0:
|
||
# S = int(a[-1]) + int(a[1])
|
||
# b = str(S)
|
||
# elif index != 0 and index != int(len_a) :
|
||
# n_index_0 = int(int(a.index(number)) + 1)
|
||
# n_index_2 = int(int(a.index(number)) - 1)
|
||
# n_0 = a[n_index_0]
|
||
# N_2 = a[n_index_2]
|
||
# S1 = int(n_0) + int(N_2)
|
||
# b += " " + str(S1)
|
||
# elif index == int(len_a):
|
||
# S2 = int(a[0]) + int(a[-2])
|
||
# b += " " + str(S2)
|
||
# print (b)
|
||
# x = [int(m) for m in str(b)]
|
||
# print (x) в список
|
||
# print (" ".join(b))
|
||
|
||
# initial_list = input().split()
|
||
# sum_list = []
|
||
# left_index = -1
|
||
# right_index = -len(initial_list) + 1
|
||
# middle_index = 0
|
||
# while middle_index < len(initial_list):
|
||
# sum_list.append(initial_list[left_index] + initial_list[right_index])
|
||
# left_index += 1
|
||
# right_index += 1
|
||
# middle_index += 1
|
||
# print(sum_list)
|
||
|
||
|
||
# a = [int(item) for item in input().split()]
|
||
# a2 = []
|
||
# for i in range(len(a)):
|
||
# if len(a) == 1:
|
||
# print(a[0])
|
||
# break
|
||
# else:
|
||
# if i == 0:
|
||
# a2.append(a[-1] + a[i + 1])
|
||
# elif i > 0 and i != len(a) - 1:
|
||
# a2.append(a[i - 1] + a[i + 1])
|
||
# else:
|
||
# a2.append(a[i - 1] + a[0])
|
||
# if a2 != 0:
|
||
# for i in a2:
|
||
# print(i, end=' ')
|
||
|
||
# a = input().split()
|
||
# a_sorted= a.sort()
|
||
# int=0
|
||
# for i, item in enumerate(a):
|
||
# if len(a) == 1:
|
||
# None
|
||
# else:
|
||
# # if a [i] == a [i+1]:
|
||
# n =
|
||
|
||
# a = input().split()
|
||
# a2 = []
|
||
# for item in a:
|
||
# c = a.count(item)
|
||
# if c > 1:
|
||
# a2.append(item)
|
||
# if c == 1:
|
||
# None
|
||
# def del_dubl(a2):
|
||
# seen = set()
|
||
# seen_add = seen.add
|
||
# return [x for x in a2 if not (x in seen or seen_add(x))]
|
||
# for i in del_dubl(a2):
|
||
# print(i, end=' ')
|
||
|
||
# удаление дубликатов
|
||
a = input().split()
|
||
def del_dubl(a):
|
||
seen = set()
|
||
seen_add = seen.add
|
||
return [x for x in a if not (x in seen or seen_add(x))]
|
||
print (del_dubl(a))
|
||
|
||
# n =3
|
||
# a = [[0]*n]*n
|
||
# a[0][0]= 5
|
||
# print (a)
|
||
|
||
|
||
# from scipy.stats import f
|
||
# data = pd.DataFrame({1:[3,1,2],2:[5,3,4],3:[7,6,5]}) # Here 3 groups and we are going to compare them
|
||
# def odno_disp(data):
|
||
# first_group = [i for i in data[1]] # Выделяем группы для операции над данными
|
||
# second_group = [i for i in data[2]]
|
||
# third_group = [i for i in data[3]]
|
||
# number_of_groups = len([first_group,second_group,third_group])
|
||
|
||
# all_groups = first_group+second_group+third_group # Все группы тут
|
||
# mean_of_all_groups = np.mean(all_groups) # среднее значение всей группы
|
||
|
||
# sum_of_squared_total = sum([(i-mean_of_all_groups)**2 for i in all_groups]) # Обьщая изменчивость наших данных, здесь мы расчитали сумму всех квадратов отклонение от среднего
|
||
# df_of_sst = len(all_groups) - 1 # Число степеней свободы в SST
|
||
|
||
# ssw1 = sum([(i-np.mean(first_group))**2 for i in first_group]) # для расчета суммы квадратов
|
||
# ssw2 = sum([(i-np.mean(second_group))**2 for i in second_group]) # расчитаем сумму кв всех групп
|
||
# ssw3 = sum([(i-np.mean(third_group))**2 for i in third_group])
|
||
# sum_of_squared_within = ssw1+ssw2+ssw3 # сумма квадратов внутри групповая
|
||
# df_of_ssw = len(all_groups) - number_of_groups # Число степеней свободы во внутри групповой
|
||
|
||
# # Теперь узнаем на сколько наши групповые отклоняются от общегрупповых средних
|
||
# for_minus_from_each_group = [first_group, second_group, third_group] # для минуса из каждых групп
|
||
# sum_of_squared_between = sum([number_of_groups*(np.mean(i)-mean_of_all_groups)**2 for i in for_minus_from_each_group])
|
||
# df_of_ssb = number_of_groups - 1
|
||
|
||
# F = (sum_of_squared_between / df_of_ssb) / (sum_of_squared_within / df_of_ssw)
|
||
# P_value = f.sf(F, df_of_ssb, df_of_ssw)
|
||
# if P_value >= 0.05:
|
||
# return f"Мы не отклоняем нулевую гипотезу так как P_value = {P_value}"
|
||
# else:
|
||
# return f"Мы отклоняем нулевую гипотезу то есть P value = {P_value}, H1 верна то есть минимум 2 данные различаются между собой в Генеральной совокупонсти"
|
||
# p = odno_disp(data)
|
||
# p |