TelenkovDmitry il y a 1 an
Parent
commit
77e5d568a5
2 fichiers modifiés avec 367 ajouts et 6 suppressions
  1. 47 6
      courses/python_for_begginers/misc.py
  2. 320 0
      courses/python_indi/test.py

+ 47 - 6
courses/python_for_begginers/misc.py

@@ -1,6 +1,47 @@
-number = int(input())
-d = number%10
-c = (number//10)%10
-b = (number//100)%10
-a = number//1000
-print(a, b, c, d)
+# -----------------------------------------------------
+
+# number = int(input())
+# d = number%10
+# c = (number//10)%10
+# b = (number//100)%10
+# a = number//1000
+# #print(a, b, c, d)
+
+# price = int(input())
+# number = 0
+
+# while price:
+#     if price//25 != 0:
+#         number += price//25
+#         price -= price//25*25
+#     elif price//10 != 0:
+#         number += price//10
+#         price -= price//10*10
+#     elif price//5 != 0:
+#         number += price//5
+#         price -= price//5*5
+#     elif price//1 != 0:
+#         number += price//1
+#         price -= price//1*1
+# print(number)
+
+# -----------------------------------------------------
+
+# my_string = '192.168.1.115'
+# my_list = my_string.split('.')
+# my_flag = True
+# for i in my_list:
+#     if 0 <= int(i) <= 255:
+#         my_flag = False
+
+# if my_flag == False:
+#     print('NO')
+# else:
+#     print('YES')
+
+# -----------------------------------------------------
+
+# my_string = 'Hello world'
+# splitter = '*'
+# my_list = list(my_string)
+# print(splitter.join(my_list))

+ 320 - 0
courses/python_indi/test.py

@@ -0,0 +1,320 @@
+
+# a,b = map(int, input().split())
+# print(a, b)
+
+# num = [1, 2, 3, 4, 5]
+# print(*num)
+
+# s = input()
+# print(s)
+# while (len(s) != 0 and len(s) != 1):
+#     s = s[1:-1]
+#     print(s)
+
+# a, b = map(int, input().split())
+# cnt = 0
+# x = 0
+# while a > 0:
+#     cnt += 1
+#     a -= 1
+#     x += 1
+#     if (x == b):
+#         x = 0
+#         a += 1
+# print(cnt)
+
+# a = int(input())
+# st = 1
+# if a == 1:
+#     print('0')
+# else:
+#     while 2**st <= a:
+#         if 2**st == a:
+#             print(st)
+#             break
+#         st += 1
+#     if 2**st > a:
+#         print('НЕТ')
+
+# n = int(input())
+# while n < 1000000000:
+#     st = str(n)
+#     n = int(st[0])*n
+#     if int(st[0]) == 1:
+#         break
+# print(n)
+
+# sum = 0
+# while (n := int(input())) != 0:
+#     sum += n
+# print(sum)
+
+# s = input()
+# while 5 <= len(s) <= 9:
+#     last = s
+#     s = input()
+# print(last)
+
+# n = int(input())
+# x = int(input())
+# if x > n:
+#     print(0)
+#     print('Довольно')
+# else:
+#     sum = x
+#     while sum <= n:
+#         x = input()
+#         sum += x
+
+# print(sum - x)
+# print('Довольно')
+
+# n, k = map(int, input().split())
+# time = 0
+# cnt = 0
+# while time <= (240 - k) and cnt <= n:
+#     cnt += 1
+#     time += cnt*5  
+# print(cnt - 1)
+
+# n = int(input())
+# l = 0
+# k = 0
+# s = 1
+# while k < n:
+#     s = 1 + l
+#     k = k + s
+#     l += 1
+
+# if (k > n):
+#     print(l - 1)
+# else:
+#     print(l)
+
+# a = int(input())
+# b = int(input())
+
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# НОД
+
+# a = int(input())
+# b = int(input())
+
+# while b > 0:
+#     c = a%b
+#     a = b
+#     b = c
+# print(f'НОД = {a}')        
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# НОД
+
+# a = int(input())
+# b = int(input())
+
+# while a != b:
+#     if a > b:
+#         a = a - b
+#     else:
+#         b = b - a
+# print(f'НОД = {a}')
+
+# a = int(input())
+# b = int(input())
+
+# while b > 0:
+#     c = a%b
+#     a = b
+#     b = c
+# print(f'НОД = {a}')   
+
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Сортировка массива пузырьком
+
+# buf = [5, 7, 3, 1, 6, 4, 8, 1, 9]
+# cnt = 0
+
+# for run in range(len(buf) - 1):
+#     for i in range(len(buf) - run - 1):
+#         if buf[i] > buf[i + 1]:
+#             cnt += 1
+#             buf[i], buf[i + 1] = buf[i + 1], buf[i]
+
+# print(*buf)
+# print(cnt)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Система уравнений
+# n, m = map(int, input().split())
+# cnt = 0
+# for b in range(0, n + 1 ):
+#     for a in range(0, m + 1):
+#         if (a**2 + b) == n and (a + b**2) == m:
+#             cnt += 1
+# print(cnt)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Сортировка вставками
+
+# buf = [5, 7, 3, 1, 6, 4, 8, 1, 9]
+# buf = [5, 4, 2, 15, 6, 6]
+# cnt = 0
+
+# for run in range(1, len(buf)):
+#     for i in range(run, 0, -1):
+#         if buf[i] < buf[i - 1]:
+#             cnt += 1
+#             buf[i], buf[i - 1] = buf[i - 1], buf[i]
+#         else:
+#             break
+
+# print(*buf)
+# print(cnt)
+
+# def foo(len):
+#     if len < 0:
+#         sign = -2
+#     else:
+#         sign = 2
+#     return [i for i in range(0, len, sign)]
+
+# print(foo(-10))
+
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# # n, m = map(int, input().split())
+# # l = []
+# n, m = 3, 3
+# l = [[6, 2, 7], [1, 2, 8], [1, 3, 8]]
+# maxi = []
+# summ = []
+
+# # for i in range(n):
+# #     l.append(list(map(int, input().split())))
+
+# for i in range(n):
+#     maxi.append(max(l[i]))
+#     summ.append(sum(l[i]))
+
+# maximum = max(maxi)
+# foo_cnt = maxi.count(maximum)
+
+# if foo_cnt == 1:
+#     print(max.index(maximum))
+# else:
+#     for i in range(n):
+#         if maxi[i] != maximum:
+#             summ[i] = 0
+
+#     sum_max = max(summ)
+#     print(summ.index(sum_max))
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# n, m = map(int, input().split())
+# l = []
+# maxi = []
+
+# for i in range(n):
+#     l.append(list(map(int, input().split())))
+
+# for i in range(n):
+#     maxi.append(max(l[i]))
+
+# maximum = max(maxi)
+# print(maxi.count(maximum))
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# l = [['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W']]
+# flag = 'Yes'
+# # for i in range(4):
+# #     l.append(list(input()))
+
+# for i in range(4):
+#     for j in range(4):
+#         l[i][j] = ord(l[i][j])%10 - 6
+
+# for i in [0, 1, 2]:
+#     for j in [0, 1, 2]:
+#         if l[i][j] == l[i][j + 1] == l[i + 1][j] == l[i + 1][j + 1]:
+#             flag = 'No'
+
+# print(flag)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# n, m = map(int, input().split())
+# # l1 = []
+# # l2 = []
+# l1 = [['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W']]
+# l2 = [['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W']]
+
+# # for i in range(n):
+# #     l1.append(list(input()))
+
+# # input()
+
+# # for i in range(n):
+# #     l2.append(list(input()))    
+
+# cnt = 0
+
+# for i in range(n):
+#     for j in range(m):
+#         if l1[i][j] == l2[i][j]:
+#             cnt += 1
+
+# print(cnt)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# n, x = map(int, input().split())
+# cnt = 0
+# for i in range(1, n + 1):
+#     for j in range(1, n + 1):
+#         if i*j == x:
+#             cnt += 1
+
+# print(cnt)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# n = int(input())
+# l = []
+# maxi = []
+
+# for i in range(n):
+#     l.append(list(map(int, input().split())))
+
+# for i in range(n):
+#     maxi.append(l[i][n - i - 1])
+
+# print(max(maxi))
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+n = int(input())
+a, b, c = map(int, input().split())
+l = []
+
+for i in range(n):
+    l.append([0]*n)
+
+diag = 0
+for i in range(n):
+    for j in range(n):
+        if i == j:
+            l[i][j] = c
+        elif j < diag:
+            l[i][j] = b
+        else :
+            l[i][j] = a
+    diag += 1
+
+for i in range(n):
+    print(*l[i])