合肥生活安徽新闻合肥交通合肥房产生活服务合肥教育合肥招聘合肥旅游文化艺术合肥美食合肥地图合肥社保合肥医院企业服务合肥法律

代做COMP9021、代写Python设计编程

时间:2024-04-03  来源:合肥网hfw.cc  作者:hfw.cc 我要纠错



COMP9021 Principles of Programming
Term 1, 2024
Coding Quiz 5
Worth 4 marks and due Week 8 Thursday @ 9pm
Description
You are provided with a stub in which you need to insert your code where indicated without doing
any changes to the existing code to complete the task.
Given the value of seed and density, the provided code randomly fills an array (or grid) of size
10 x 10 with 0s and 1s. Your task is to determine and output the size of the largest parallelogram
with horizontal sides. A parallelogram consists of a line with at least 2 consecutive 1s, with below
at least one line with the same number of consecutive 1s, all those lines being aligned vertically in
which case the parallelogram is actually a rectangle, for instance:
1 1 1
1 1 1
1 1 1
1 1 1
or consecutive lines move to the left by one position, for instance:
 1 1 1
 1 1 1
 1 1 1
1 1 1
or consecutive lines move to the right by one position, e.g.
1 1 1
 1 1 1
 1 1 1
 1 1 1
The size is the number of 1s in the parallelogram. In the above examples, the size is 12.
See test cases below for more examples.
2
Due Date and Submission
Quiz 5 is due Week 8 Thursday 4 April 2024 @ 9.00pm (Sydney time).
Note that late submission with 5% penalty per day is allowed up to 3 days from the due date, that
is, any late submission after Week 7 Sunday 7 April 2024 @ 9pm will be discarded.
Make sure not to change the filename quiz_5.py while submitting by clicking on [Mark] button
in Ed. It is your responsibility to check that your submission did go through properly using
Submissions link in Ed otherwise your mark will be zero for Quiz 5.
Test Cases
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 1
Here is the grid that has been generated:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
There is no parallelogram with horizontal sides.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1 1 0
0 0 1 0 1 1 0 1 0 0
0 0 0 1 0 0 1 1 0 1
1 0 1 0 1 1 0 1 1 0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The largest parallelogram with horizontal sides has a size of 4.
3
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 3
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 0 1 0 1 0 0 1 1 1
1 1 0 1 0 1 0 1 1 1
1 0 1 1 1 1 1 0 1 1
1 1 1 0 1 0 0 1 1 1
1 1 0 1 1 1 0 1 1 1
0 0 1 0 0 0 1 1 0 0
1 1 1 0 1 1 1 1 0 1
1 1 0 1 1 1 1 1 0 1
1 1 1 0 1 0 0 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 1 1 0
0 0 1 0 1 1 1 1 0 1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 0
1 0 1 1 1 1 1 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
4
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 1 4
Here is the grid that has been generated:
1 0 1 0 1 1 1 1 1 0
1 0 1 1 0 1 1 1 0 1
0 0 0 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 0
1 1 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 0 1
0 1 1 1 1 0 1 0 1 1
1 1 1 0 1 1 1 1 1 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1 0 1
The largest parallelogram with horizontal sides has a size of 16.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 5
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 0 0 1 1 1 0 1
1 1 1 1 1 1 1 1 1 0
1 0 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 1 0 0
1 1 1 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 0 0 1 1 0 0 1 1 1
The largest parallelogram with horizontal sides has a size of 15.
5
Test Cases Explained
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 1
Here is the grid that has been generated:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
There is no parallelogram with horizontal sides.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1 1 0
0 0 1 0 1 1 0 1 0 0
0 0 0 1 0 0 1 1 0 1
1 0 1 0 1 1 0 1 1 0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The largest parallelogram with horizontal sides has a size of 4.
6
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 3
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 0 1 0 1 0 0 1 1 1
1 1 0 1 0 1 0 1 1 1
1 0 1 1 1 1 1 0 1 1
1 1 1 0 1 0 0 1 1 1
1 1 0 1 1 1 0 1 1 1
0 0 1 0 0 0 1 1 0 0
1 1 1 0 1 1 1 1 0 1
1 1 0 1 1 1 1 1 0 1
1 1 1 0 1 0 0 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 1 1 0
0 0 1 0 1 1 1 1 0 1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 0
1 0 1 1 1 1 1 0 0 1
The largest parallelogram with horizontal sides has a size of 12.
7
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 1 4
Here is the grid that has been generated:
1 0 1 0 1 1 1 1 1 0
1 0 1 1 0 1 1 1 0 1
0 0 0 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 0
1 1 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 0 1
0 1 1 1 1 0 1 0 1 1
1 1 1 0 1 1 1 1 1 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1 0 1
The largest parallelogram with horizontal sides has a size of 16.
$ python3 quiz_5.py
Enter two integers, the second one being strictly positive: 0 5
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 0 0 1 1 1 0 1
1 1 1 1 1 1 1 1 1 0
1 0 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 1 0 0
1 1 1 0 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
1 0 0 1 1 0 0 1 1 1
The largest parallelogram with horizontal sides has a size of 15.

请加QQ:99515681  邮箱:99515681@qq.com   WX:codinghelp

扫一扫在手机打开当前页
  • 上一篇:越南S2结婚签证费用是多少(S2签证是什么)
  • 下一篇:学生签入境菲律宾条件(学生签申请指南)
  • 无相关信息
    合肥生活资讯

    合肥图文信息
    海信罗马假日洗衣机亮相AWE  复古美学与现代科技完美结合
    海信罗马假日洗衣机亮相AWE 复古美学与现代
    合肥机场巴士4号线
    合肥机场巴士4号线
    合肥机场巴士3号线
    合肥机场巴士3号线
    合肥机场巴士2号线
    合肥机场巴士2号线
    合肥机场巴士1号线
    合肥机场巴士1号线
    合肥轨道交通线路图
    合肥轨道交通线路图
    合肥地铁5号线 运营时刻表
    合肥地铁5号线 运营时刻表
    合肥地铁4号线 运营时刻表
    合肥地铁4号线 运营时刻表
  • 关于我们 | 打赏支持 | 广告服务 | 联系我们 | 网站地图 | 免责声明 | 帮助中心 | 友情链接 |

    Copyright © 2020 hfw.cc Inc. All Rights Reserved. 合肥网 版权所有
    ICP备06013414号-3 公安备 42010502001045