当前位置: 高中信息技术 / 多选题
  • 1. (2021高二上·温州期末) 我国古代数学家张丘建在《算经》一书中提出了如下的数学问题:鸡翁一,值钱五;鸡母一,值钱三;鸡雏三,值钱一。百钱买百鸡,问翁、母、雏各几何?用Python编写程序如下:

    for x in range(0,21):

      for y in range(0,34):

       

    方框内代码可以为:

    A . for z in range(0,101,1):

    if x+y+z==100 and 5*x+3*y+z/3==100:

    print("鸡翁",x,"鸡母",y,"鸡雏",z)

    B . for z in range(0,101,3):

    if x+y+z==100 and 5*x+3*y+z/3==100:

    print("鸡翁",x,"鸡母",y,"鸡雏",z)

    C . z=100-x-y

    if 5*x+3*y+z/3==100:

    print("鸡翁",x,"鸡母",y,"鸡雏",z)

    D . z=(100-x-y)/3

    if 5*x+3*y+z/3==100:

    print("鸡翁",x,"鸡母",y,"鸡雏",z)

微信扫码预览、分享更方便