One more math bruteforce script
This commit is contained in:
parent
ad93333cf6
commit
56d0dc79eb
1 changed files with 29 additions and 0 deletions
29
math_bruteforce/logic_exercise_bruteforce.py
Normal file
29
math_bruteforce/logic_exercise_bruteforce.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
print("")
|
||||
print("*** EXERCISE BRUTEFORCE ***")
|
||||
print("")
|
||||
|
||||
light_count = 120
|
||||
lamps_in_chnd = 1
|
||||
lamps_in_scn = 3
|
||||
|
||||
chnd_lamps_count = 0
|
||||
scn_lamps_count = 0
|
||||
solved = False
|
||||
|
||||
for chnd_count in range(light_count+1):
|
||||
for scn_count in range(light_count+1):
|
||||
#if (chnd_count + scn_count) > light_count:
|
||||
#continue
|
||||
chnd_lamps_count = lamps_in_chnd * chnd_count
|
||||
scn_lamps_count = lamps_in_scn * scn_count
|
||||
solved = (chnd_lamps_count == scn_lamps_count) and (chnd_lamps_count > 0) and (scn_lamps_count > 0)
|
||||
print(chnd_lamps_count, chnd_count, scn_lamps_count, scn_count, solved)
|
||||
if (solved):
|
||||
print("OK")
|
||||
break
|
||||
if (solved):
|
||||
break
|
||||
|
||||
print("")
|
||||
print("Finished")
|
||||
input("")
|
Loading…
Add table
Reference in a new issue