找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 934|回复: 0

[求助] 新人求助python官网这个案例程序怎么写?

1

主题

2

帖子

2

积分

贫民

积分
2
Mia 发表于 2022-9-1 09:42:09 | 显示全部楼层 |阅读模式
Scenario
Listen to this story: a boy and his father, a computer programmer, are playing with wooden blocks. They are building a pyramid.
Their pyramid is a bit weird, as it is actually a pyramid-shaped wall - it's flat. The pyramid is stacked according to one simple principle: each lower layer contains one block more than the layer above.

The figure illustrates the rule used by the builders:


Your task is to write a program which reads the number of blocks the builders have, and outputs the height of the pyramid that can be built using these blocks.
Note: the height is measured by the number of fully completed layers - if the builders don't have a sufficient number of blocks and cannot complete the next layer, they finish their work immediately.
Test your code using the data we've provided.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表