一筐鸡蛋,1个1个拿,正好拿完;2个2个拿,还剩1个;3个3个拿,正好拿完;4个4个拿,还剩1个;5个5个拿,还差1个;6个6个拿,还剩3个;7个7个拿,正好拿完;8个8个拿,还剩1个;9个9个拿,正好拿完。求框里最少有多少鸡蛋?利用元组数据结构,编程求解。写出程序代码
求指导怎么写,题目是必须要元组,请问怎么解决呢?
x = 0
while True:
if x % 3 == 0 and x % 7 == 0 and x % 9 == 0 and x % 2 == 1 and x % 4 == 1 and x % 5 == 1 and x % 8 == 1 and x % 6 == 3:
print(x)
break
x += 1
441
必须元组?
i=1
while True:
if i%2!=1:
i+=1
continue
if i%3!=0:
i+=1
continue
if i%4!=1:
i+=1
continue
if i%5!=4:
i+=1
continue
if i%6!=3:
i+=1
continue
if i%7!=0:
i+=1
continue
if i%8!=1:
i+=1
continue
if i%9!=0:
i+=1
continue
print(i)
break
如有帮助请采纳