欧美一级a免费放视频,欧美一级a免费放视频_丰满年轻岳欲乱中文字幕电影_欧美成人性一区二区三区_av不卡网站,99久久精品产品给合免费视频,色综合黑人无码另类字幕,特级免费黄片,看黃色录像片,色色资源站无码AV网址,暖暖 免费 日本 在线播放,欧美com

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代寫 CS 336,、代做 java/c++設(shè)計(jì)程序
代寫 CS 336,、代做 java/c++設(shè)計(jì)程序

時(shí)間:2024-11-10  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



CS 336: Algorithms Problem Set 5 Date: Thursday, October 31, 2024 Due: Thursday, November 7, 2024
Submit your solution on Gradescope.
Please, solve all problems on your own. Do not collaborate with other students.
Problem 1. The page limit for Problem 1 is 2 pages.
Similarly to HW2, you want to travel from city A to city B located on a straight line (A is
located in position 0 and B is located in position M ≥ 0), and you can travel at most distance D ≥ 0 miles per day, and you can only move to the right. Similarly, you have hotels between A and B with locations a1, . . . , an, where you can stay for a night.
You are a person who likes to optimize all aspects of your life. In particular, if you didn’t fully use all D miles per day, it causes you great distress. Namely, if on some day you traveled distance d miles (out of possible D miles), the amount of distress is 2D−d.
You start at city A. Your goal is to reach city B while suffering the least total amount of distress. Example: Assume that D = 4 and city B is located in position 6. You have two hotels in locations
2 and 3. The following routes have the following distress:
• 0→2→6: 24−(2−0) +24−(6−2) =4+1=5
• 0→2→3→6: 24−(2−0) +24−(3−2) +24−(6−3) =4+8+2=14 • 0→2→6: 24−(3−0) +24−(6−3) =2+2=4
The last route is optimal.
Please do the following:
• Formulate the subproblem. Please state it as precisely as possible. • Design a dynamic programming algorithm for solving this problem:
– State the base case.
– State the recurrence relation.
– Explain why the recurrence relation is correct (from your explanation, one should un- derstand how to get your the recurrence relation).
– Please provide the pseudocode. Please use the bottom-up approach.
– Explain:
∗ What is the running time of your algorithm (all arithmetic operations take constant time).
∗ How to recover the maximum reward.
∗ How to recover the optimal route. You don’t need to write a pseudocode.
∗ How your algorithm correctly handles the case when an optimal solution doesn’t
exist.
 1

Problem 2. There is a new series in your streaming platform, Panopto. The series contains n episodes in total. Episodes need to be watched in order; that is, you cannot watch episode j before episode i if i < j. Since you’re busy, you decide to skip some subset of episodes (potentially empty). Your goal is to minimize the total amount of energy needed for this series, computed as follows:
• You figure out that if you skip episode i, you would have to spend pi energy at the end of the year to figure out the missed content.
• In addition, each episode has excitement value ei. You don’t want to dramatically change your emotions as well. So, for any consecutive episode i and j you watch, you need to spend |ei − ej | energy to adjust your mood as well.
For example, if there are 5 episodes:
• If you decide to watch episodes 1, 3, and 4, you need to spend p2 +p5 +|e1 −e3|+|e3 −e4| units of energy.
• If you only decide to watch episode 3, you need to spend p1 + p2 + p4 + p5 units of energy.
• If you decide to watch none of the episodes, you need to spend p1 +p2 +p3 +p4 +p5 units of
energy.
Implement the following function, which returns the list of episodes you decided to watch in the sorted order (the episodes are **indexed). For example, if you decide to watch first, third, and fourth episodes, your function must return a vector with items 1,3,4, in exactly this order. The input arrays are e and p respectively. It is guaranteed that for all test cases, the optimal answer is unique.
    vector<int> Episodes(const vector<int>& excitement, const vector<int>& penalty)
Time limit The instructions are similar to the previous programming assignments. Your program should pass each tests in no more than 1 second. You can assume that 1 ≤ n ≤ 104 and all numbers are between 1 and 109.



請(qǐng)加QQ:99515681  郵箱:[email protected]   WX:codinghelp

掃一掃在手機(jī)打開當(dāng)前頁(yè)
  • 上一篇:代做CMPT 401,、代寫 c++設(shè)計(jì)程序
  • 下一篇:代寫 CP3405、代做 Python/C++語言編程
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    出評(píng) 開團(tuán)工具
    出評(píng) 開團(tuán)工具
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)400(全國(guó)服務(wù)熱線)
    戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)
    菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話24小時(shí)服務(wù)熱線
    菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話2
    美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)客服熱線
    美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)
    海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機(jī)場(chǎng)巴士4號(hào)線
    合肥機(jī)場(chǎng)巴士4號(hào)線
    合肥機(jī)場(chǎng)巴士3號(hào)線
    合肥機(jī)場(chǎng)巴士3號(hào)線
  • 上海廠房出租 短信驗(yàn)證碼 酒店vi設(shè)計(jì)