total_students = 52 big_boat = total_students // 6 small_boat = (total_students - big_boat * 6) // 4 if (total_students - big_boat * 6 - small_boat * 4) > 0: small_boat += 1 print("大船数量:", big_boat) print("小船数量:", small_boat) print("总共船只数量:", big_boat + small_boat)

使用Python52个同学乘船大船6人小船4人输出大小船各几个共11条船

原文地址: https://www.cveoy.top/t/topic/cQpm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录