[Python/2019] Restructure solutions
This commit is contained in:
parent
40e767096e
commit
fb42493fff
63 changed files with 1393 additions and 1739 deletions
24
Python/2019/04.py
Normal file
24
Python/2019/04.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2019, 4)
|
||||
|
||||
a, b = map(int, input.split("-"))
|
||||
count = 0
|
||||
for i in range(a, b + 1):
|
||||
string = str(i)
|
||||
if list(string) != sorted(string):
|
||||
continue
|
||||
if any(x == y for x, y in zip(string[1:], string)):
|
||||
count += 1
|
||||
print(count)
|
||||
|
||||
|
||||
a, b = map(int, input.split("-"))
|
||||
count = 0
|
||||
for i in range(a, b + 1):
|
||||
string = str(i)
|
||||
if list(string) != sorted(string):
|
||||
continue
|
||||
if any(string.count(c) == 2 for c in string):
|
||||
count += 1
|
||||
print(count)
|
Loading…
Add table
Add a link
Reference in a new issue