Author

Topic: How many operation (Read 118 times)

member
Activity: 206
Merit: 16
February 24, 2023, 01:31:17 PM
#3
Code:
import random

x = 1

while x > 0:
    liste1 = random.choice('0123456789abcdef')
    liste2 = random.choice('0123456789abcdef')
    liste3 = random.choice('0123456789abcdef')
    liste4 = random.choice('0123456789abcdef')
    liste5 = random.choice('0123456789abcdef')
    liste6 = random.choice('0123456789abcdef')
    liste7 = random.choice('0123456789abcdef')
    liste8 = random.choice('0123456789abcdef')
    liste9 = random.choice('0123456789abcdef')
    liste10 = random.choice('0123456789abcdef')
    liste11 = random.choice('0123456789abcdef')
    liste12 = random.choice('0123456789abcdef')
    liste13 = random.choice('0123456789abcdef')
    liste14 = random.choice('0123456789abcdef')
    liste15 = random.choice('0123456789abcdef')
    liste16 = 3
    liste17 = 5
    liste = 3+5+int(liste1,16)+int(liste2,16)+int(liste3,16)+int(liste4,16)+int(liste5,16)+int(liste6,16)+int(liste7,16)+int(liste8,16)+int(liste9,16)+int(liste10,16)+int(liste11,16)+int(liste12,16)+int(liste13,16)+int(liste14,16)+int(liste15,16)
    if liste == 97:
        print(str(liste16)+str(liste17)+str(liste1)+str(liste2)+str(liste3)+str(liste4)+str(liste5)+str(liste6)+str(liste7)+str(liste8)+str(liste9)+str(liste10)+str(liste11)+str(liste12)+str(liste13)+str(liste14)+str(liste15))

all good
full member
Activity: 161
Merit: 230
February 24, 2023, 12:51:50 PM
#2
Look up the "Subset Sum" problem
member
Activity: 206
Merit: 16
February 24, 2023, 09:37:54 AM
#1
liste = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

while x == 97:


how many operation "+" can we have to obtain 97 knowing that only 17 numbers are allowed.

start with 3 + 5 + 15 numbers
Jump to: