首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如果考试让带一样东西,你会带什么?

题目

这是菲菲的一道作业题,自从学了编程后,她就习惯性思维想用编程去解,用她的话说“编程不用动脑子”,其实数学方法更锻炼人的思维,欢迎大家聊聊此题的数学方法!

如果考试让带一样东西,那肯定是带电脑了!

菲菲视频讲解

答案

一共有2736种填法

如:

one: 9

two: 83

three: 674

four: 1250

one: 9

two: 84

three: 250

four: 1673

one: 9

two: 84

three: 253

four: 1670

one: 9

two: 84

three: 270

four: 1653

one: 9

two: 84

three: 273

four: 1650

one: 9

two: 84

three: 650

four: 1273

one: 9

two: 84

three: 653

four: 1270

one: 9

two: 84

three: 670

four: 1253

one: 9

two: 84

three: 673

four: 1250

……

代码

cnt =

forone inrange(10):

fortwo inrange(10,100):

forthree inrange(100,1000):

four =2016- one - two - three

print('one:',one)

print('two:',two)

print('three:',three)

print('four:',four)

print()

cnt = cnt +1

print(cnt)

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20181030B0FU1100?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券