Добавил задания 20 и 8 (возможно, другие номера, не знаю)

This commit is contained in:
Dmitriy Shishkov 2020-11-27 16:32:05 +05:00
parent 11355292e6
commit 02d2d37492
No known key found for this signature in database
GPG Key ID: D76D70029F55183E
17 changed files with 164 additions and 0 deletions

14
20/1.py Executable file
View File

@ -0,0 +1,14 @@
for x in range(1, 1000):
a, b = 0, 1
xx = x
while xx > 0:
if xx % 2 > 0:
a += 1
else:
b += xx % 5
xx //= 5
if a == 2 and b == 9:
print(x)
break
# 605

14
20/2.py Executable file
View File

@ -0,0 +1,14 @@
for x in reversed(range(1, 1000)):
a, b = 0, 1
xx = x
while xx > 0:
if xx % 2 > 0:
a += 1
else:
b += xx % 5
xx //= 5
if a == 2 and b == 6:
print(x)
break
# 960

13
20/3.py Executable file
View File

@ -0,0 +1,13 @@
for x in range(1, 1000):
xx = x
x0 = x
n = 0
while xx > 0:
d = xx % 3
n = 10*n + d
xx //= 3
if n // 100000 > 0:
print(x)
break
# 244

13
20/4.py Executable file
View File

@ -0,0 +1,13 @@
k = 0
for x in range(-1000, 1000):
xx = x
a, b = 0, 1
while xx > 0:
a += 1
b *= xx % 10
xx //= 10
if a == 2 and b == 0:
k += 1
print(k)
# 9

14
20/5.py Executable file
View File

@ -0,0 +1,14 @@
for x in range(100, 10000):
xx = x
l = xx - 16
m = xx + 16
while l != m:
if l > m:
l -= m
else:
m -= l
if m == 16:
print(x)
break
# 128

16
20/6.py Executable file
View File

@ -0,0 +1,16 @@
for x in reversed(range(1, 10000)):
xx = x
q = 6
l = 0
while xx >= q:
l += 1
xx -= q
m = xx
if m < l:
m = l
l = xx
if l == 3 and m == 5:
print(x)
break
# 33

7
8/17.py Normal file
View File

@ -0,0 +1,7 @@
n, s = 24, 0
while n <= 28:
s += 20
n += 2
print(s)
# 60

7
8/24.py Normal file
View File

@ -0,0 +1,7 @@
n, s = 0, 0
while s <= 365:
s += 36
n += 10
print(n)
# 110

11
8/31.py Normal file
View File

@ -0,0 +1,11 @@
for d in range(1, 10000):
dd = d
n, s = 1, 46
while s <= 2700:
s += dd
n += 4
if n == 121:
print(d)
break
# 89

15
8/39.py Normal file
View File

@ -0,0 +1,15 @@
m, M = 10000000, -1
for d in range(1, 10000000):
dd = d
n, s = 0, 24
while s <= 1318:
s += dd
n += 15
if n == 195:
if d < m:
m = d
if d > M:
M = d
print(m, M)
# 100 107

7
8/46.py Normal file
View File

@ -0,0 +1,7 @@
s, n = 0, 0
while s * s <= 10 * s:
s += 1
n += 2
print(n)
# 22

8
8/53.py Normal file
View File

@ -0,0 +1,8 @@
a, b, c = 0, 0, 0
while 2*a < 200:
b += 3
c -= 1
a += b + c
print(a - 10)
# 100

7
8/60.py Normal file
View File

@ -0,0 +1,7 @@
s, n = 6, 60
while n > s:
s += 1
n -= 2
print(n)
# 24

7
8/p-02.py Normal file
View File

@ -0,0 +1,7 @@
s, n = 33, 1
while s > 0:
s -= 7
n *= 3
print(n)
# 243

11
8/p-03.py Normal file
View File

@ -0,0 +1,11 @@
for d in reversed(range(1, 1000000)):
dd = d
n, s = 0, 0
while s <= 365:
s += dd
n += 5
if n == 55:
print(d)
break
# 36

View File