代做320SC编程、代写Python设计程序
Computer Science 320SC – (2024)
Programming Assignment 5
Due: Oct 13 2024 (11:59pm)
Academic Integrity
Before attempting to solve the assignment, please read the message below very carefully.
As described on https://academicintegrity.cs.auckland.ac.nz/, you must NOT
ˆ Use all or part of another student’s solution to the assignment. Changing variable names or
substituting words in a sentence does not make it your solution.
ˆ Allow someone else to complete all or part of the assignment for you.
ˆ Solicit answers for the assignment on contract-cheating websites such as Chegg.com and
Bartleby.com.
ˆ Use code from Internet sources such as StackOverffow or generative-AI tools such as ChatGPT.
You are encouraged to learn from Internet sources and tools, but you need to come up
with your own implementation of the code to show your learning.
ˆ Allow another student to copy all or part of your solution to the assignment.
ˆ Do all or part of an assignment for someone else.
ˆ Share code that can lead to the solution of an assignment.
ˆ Post the assignment anywhere online or share it with anyone else. The assignment material
is copyrighted and sharing or posting them online violates our copyright.
ˆ Post your solution online on public websites. Your online solutions will encourage other
students to copy your solution. Private GitHub repositories and other private online storage
drives are acceptable, and you can also share your solution privately with prospective
employers.
ˆ Reuse your own work unless discussed otherwise with the lecturer.
ˆ Leave your computers, devices, and belongings unattended — you must secure these at all
times to prevent anyone having access to your assessments or solutions.
Last year, out of 218 students, there were 11 misconducted cases found on A5 - Task 1. We kept the
submissions from the last few years to run MOSS at https://theory.stanford.edu/~aiken/moss/.
I hope that there will be no cases this year!
1Requirements
This 5th assignment lets you get familiar with dynamic programming design and development. It is
worth 5% of your total course marks. We would like you to implement efffcient dynamic programming
algorithms for two tasks: Task 1: Finding partner and Task 2: Killing enemies.
An excessive number of submissions (over 10) for a particular problem will accrue a 20% penalty per that
problem if you eventually solve it. Therefore, please write a bruteforce algorithm and test your
dynamic programming version with your own generated inputs at scale before submitting
to the automated marker.
We only accept Python programs that use built-in packages (i.e. packages that do not require pip
install).
1 Task 1: Meet your partner at skyscraper
1.1 Problem description
You are standing at the ground ffoor and your partner is waiting at the top ffoor of a skyscraper. You
will have to use an algorithmically designed lift L to reach your partner. The lift L is designed in the
manner that if you use the lift at the ffoor i, you are able to reach any ffoor from i + 1 to i + L[i] where
L[i] is a positive integer that presents the capacity of the lift at the i-th ffoor. Each time you use the
lift costs $1.
Assume that the skyscraper has n ffoors and you are at the ffoor 0. Your partner is at the ffoor n − 1
and waiting for you to see the sky view. The lift information L[i] for 0 ≤ i < n is available at the
ground ffoor. Write a function to return the minimum cost, i.e. the number of time using the lift, to
reach your partner.
O(n) solutions are preferred since we have set the running time limit on the automarker.
1.2 Test case description
Your input will be a sequence of n integers, each value per line corresponding to the lift information
L[i] (e.g. the capacity of the lift) on the i-th ffoor. The ffrst line is for the 0-th ffoor. The last line is
for the (n − 1)-th ffoor, which is a redundant information :-). Your output will be an integer.
There are 4 test cases.
1. A trial test case of n = 10 has no mark.
2. A test case of n = 100, 000 and has 1 mark.
3. A test case of n = 1000, 000 and has 2 marks.
2Sample Input 1:
Sample Output 1:
1
You only need to use the lift once since L[0] = 8 is sufffcient to get you to the 4th ffoor.
Sample Input 2:
Sample Output 2:
2
You only need to use the lift twice. The ffrst one with L[0] = 2 to the 1st ffoor, and L[1] = 5 is sufffcient
to get you to the 4th ffoor.
32 Task 2: Arrange tanks to eliminate enemies
2.1 Problem description
You have a queue of n tanks hidden in a forest. Due to the UAV of enemies, only 1 tank is used per
day, and the used tank can only be taken from the front or rear of the queue for some security reasons.
Each tank has a number indicating the number of potential units the tank can eliminate. Since tanks
are hurrily queued up during the night, you cannot organize the tank in the good order to use. Instead,
you have a queue of n values, each reffects the number of potential eliminated units for each tank in
the queue.
Since the war is more and more severe, the number of potential eliminated units dramatically increases
day-by-day. Let the labels of the number of eliminated units from n tanks in the queue be t1,t2, . . . ,tn.
In the i-th day, the used tank k will eliminate i ∗ tk units.
As a commander, for each day, your task is to give an order 1 or 0 corresponding to whether the front
or the rear tank in the queue is used. Write a program to compute the best order of using n tanks for
n days to eliminate maximum number of enemies’ units.
Since there might be several orderings that output the same number of eliminated units, you would
need to output the maximum number of eliminated units only.
You might see that the best solution runs in O(n
2
) time asymptotically. However, a program with low
memory usage (e.g. O(n)) is preferred since the automarker has limited resources, and we have set the
running time limit on the automarker.
2.2 Test case description
Your input will be a sequence of n integers, each value per line i corresponding to the amount of eliminated
units of the tank ti
. The ffrst and last lines correspond to the front and rear tanks, respectively.
Your output is an integer in range [0..2
31
] corresponding to the maximum number of eliminated units.
There are 2 test cases.
1. A trial test case of n = 10 has no mark.
2. A test case of n = 10, 000 has 2 marks.
4Sample Input 1:
Sample Output 1:
128
The order is {1, 0, 0, 1, 1}, and the maximum number of detroyed units is 4 * 1 + 10 * 2 + 4 * 3 + 8 *
4 + 12 * 5 = 128. Note that for the last tank (#3), any order of 1 or 0 does not matter.
Sample Input 2:
Sample Output 2:
261
The maximum number of detroyed units is 261 and the order is {1, 1, 1, 0, 0, 0, 0, 1}. Note that for the
last tank (#4), any order of 1 or 0 does not matter.
Submission Procedure
Submit your program solutions to https://www.automarker.cs.auckland.ac.nz.
5

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图