首页 > 其他分享 >SI 100B Programming

SI 100B Programming

时间:2024-10-31 20:44:43浏览次数:5  
标签:reordered profit Programming list 100B SI points stocks profits

SI 100B Programming Assignment 2

SI 100B TA Team

October 23, 2024

1Notice

  • This homework is due 10:00 AM October 30, Wednesday, please start early.
  • The problems should be solved individually. You should submit solutions for all problems to the onlinejudge (OJ) system, which will give a score for each submission automatically.
  • You may discuss course material, programming languages, general techniques, and share test cases withothers.
  • You’re encouraged to ask any question about problem description, environment setup, error information, grammar, functions, methods etc., or post general ideas at Piazza. It can help others too!
  • However, you may NOT read, possess, copy, or submit any part of other’s solution. You may not askothers to directly debug your program or provide specific lines of solution. You should not access another person’s account. Also, do not offer such help, and protect your account and code. Giving orreceiving inappropriate help is plagiarism, an infringement of academic integrity.
  • You are not allowed to write your solution directly by or based on code generated by AI tools.
  • Good luck and have fun!21 UNFORTUNATE STOCKHOLDER

1 Unfortunate Stockholder

“I really hate green,” the poor man sighed, looking down, and found his beloved Alexandra NikolaevnaPetrovskaya lying on the floor, stiff and cold. With her gone, his nearly hairless head now has one less hair.A month ago, he was still a rich man, with positive daily profit from his investments. However, withouthim noticing, some ofhis stocks had been falling for several days, and then suddenly hit the lower limit.Quicker than he could take any actions, his other stocks also began falling.Because he had so many stocks, he only checked the total profit every day.“Oh God! How I wish I had a

tool that can tell me the details of my stocks!”

1.1 Task

As it happens, you know how to use python, and you will kindly fulfill his wish by writing a pythonprogram to give the details of his stocks. You will be given a list of numbers, representing the profit of hisstocks, and a series of queries. For each query, you should perform the corresponding operation and print the

esult.1.2 Input/Output Specification

1.2.1 Input

The first line contains a string of float numbers, representing the profit of the stocks.The second line contains a single positive integer n, indicating the number of queries.Each of the following n lines contains a query, with details shown in the Table below. All queries will begiven in one of the formats

  • query, operation
  • query, operation, start_index, end_index, stepquery, operation, start_index, end_index, step means querying on the profit of a subset of the stocks obained by performing slicing operation. It is guaranteed that start_i代写 SI 100B Programming Assignment 2 ndex, end_index and step are all integers.If the subset of the stocks to be queried is empty, print Querying on empty list! (with a single spaceat the end of the output) and do nothing else.

1.2.2 Output

n lines, each line the result of the query.31.2 Input/Output Specification the list of profits of the sliced subset of stockscomputeavcompute, avgthe average profit of all stockscompute, avg, 5, 12, 3the average profit of the sliced subset of stocks

allompute, allthe total profit of all stockscompute, all, 6, 3, 2the total profit of the sliced subset of stocksreorderascreorder, ascthe reordered list of profitsof all stocks inascending orderreorder, asc, 7, 30, 1the list of profits with the profits of thesliced stocks reordered in ascending orderdescreorder, descthe reordered list of profitsof all stocks in descending orderreorder,desc, 3, 4, 2he list of profits with the profits of thesliced stocks reordered in descending orderrevreorder, revthe reordered list of profitsf all stocks in reverse orderrorder, rev, 9, 3, 3the list of profits with the profits of thesliced stocks reordered in reverse order1.2.3 Example

1.3 Hint

After each reorder query, the list is reordered (i.e., it is mutated), as shown in the examples.

2 Average Running Speed

As part of promoting a healthy lifestyle, the university has introduced a running App. The App generatesdata points consecutively containing the student’s positionsand timestamps during their running sessions.The App helps generate useful statistics, such as distance covered and average speed. And students can freely

select specific data points for customized analysis.

2.1 Task

You are tasked with writing a program to process data points of a running session and then evaluatea runner’s performance. Your program receives n data points at the beginning. The i-th data point Pi =(xi , yi , ti), where xi and yi are the runner’s 2D coordinates, ti is the timestamp measured in seconds. Forsimplicity, we assume that runners travels along a straightpath between two adjacent points, so the distancebetween two adjacent data points is estimated using the Euclidean distance formula:D(Pk, Pk1) = √ (xkxk1) 2 + (ykyk1) 2

52.2 Input/Output Specification

2 AVERAGE RUNNING SPEED irstly, you need to estimate the average speed V of the entire session, note that the session starts at P0 and ends at Pn1:

Myers–Briggs Type Indicator (MBTI) is a assessment particularly popular in social occasions. There isone dimension: energy orientation, which is divided into introversion and extraversion—— extraverted personobtains energy from social interactions, while introverted person obtains energy from self-reflection.However, a person’s energy orientation is not fixed. For example, a person who is initially classified asintroverted may turn out to be extraverted under some circumstances.

3.1 Task

In this scenario, a meeting consists of participants of three initial orientations: “E”, “I”, and “i”. You are

given a seating arrangement represented as an n × m matrix

标签:reordered,profit,Programming,list,100B,SI,points,stocks,profits
From: https://www.cnblogs.com/CSSE2310/p/18517784

相关文章

  • ACCFIN5242 Moodle Discussion Forum
    AssessmentBrief2024/2025Pleasemakesureyoucarefullyreadandunderstandthequestionortask.Ifyouhaveunansweredquestions,pleaseposttheseonthecourseMoodleDiscussionForum,andwe’llrespond.  AssignmentInformationCourseCodeA......
  • Cesium + geoserver (wmts) 实现离线地图服务和展示
    急用前端代码的靓仔直接抄这个h5文件后端geoserverwmts服务搭建参考链接  快速搭建一个geoserver和wmts服务-CSDN博客'<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=devic......
  • PbootCMS提示:Undefined constant "core\basic\ISURL"
    要解决Undefinedconstant"core\basic\ISURL"的问题,可以在/core/basic/Url.php文件中定义ISURL常量。在文件顶部添加以下代码:define('ISURL',false);//或者根据需要设置为true完整代码如下:1<?php2/**3*@copyright(C)2016-2099HnaoyunInc.4*......
  • mysql CA certificate ca.pem is self signed 如何解决
    当MySQL的CA证书(ca.pem)是自签名时,这意味着该证书不是由受信任的证书颁发机构(CA)签发的。这可能导致在客户端和服务器之间建立安全连接时出现问题,特别是在需要验证证书链的情况下。以下是一些解决方法和步骤,可以帮助你处理自签名的CA证书:1.将CA证书添加到受信任的证......
  • Ethernet 系列(6)-- 基础学习::OSI Model
    (写在前面:最近在学习车载以太网的知识,顺便记录一下知识点。)OSI(OpenSystemInterconnect)模型是一种网络通信框架,由国际标准化组织(‌ISO)在1985年提出,旨在为不同制造商和技术提供商的网络设备和软件提供一个通用的兼容和通信标准。这个模型将复杂的网络通信过程分解为七个独......
  • 推荐一款射频与微波电路设计软件:Keysight Genesys
    KeysightPathWaveRFSynthesisGenesys是一款专为射频(RF)和微波电路设计与仿真而开发的软件解决方案,属于KeysightTechnologies的PathWave软件平台。此平台为无线通信系统的设计、仿真和验证提供了全面的工具支持。Genesys在电路设计方面具备高度专业性,能够支持从概......
  • 网络编程-OSI模型
    OSI模型OSI是opensysteminterconnection的缩写,译为“开放式系统互联”。OSI模型把网络通信的工作分为7层,从下到上分别是物理层,数据链路层,网络层,传输层,会话层,表示层和应用层。OSI七层网路模型和TCP/IP四层网络模型的对比。网络模型:就是进行数据封装的。当另一台计算机......
  • Ant Design Vue 的 a-table 行选择分页时bug处理
    有bug的伪代码如下(示例以id来作为rowKey):<a-table:row-selection="{selectedRowKeys:selectedRowKeys,onChange:onSelectChange}":columns="columns"rowKey="id":pagination="pagination":data-source=&q......
  • Stable Diffusion技术路线发展历程回顾
    图1描述了StableDiffusion模型的发展历程,从最初的AE(AutoEncoder),逐步发展到DDPM、VQVAE、LDM,并最终产生了StableDiffusion。从技术路线上看,StableDiffusion由2条技术路线汇聚而成,一条是路线1:AE->VAE->DDPM,另一条是路线2:AE->VQVAE->LDM。路线1主要解决生成图像质......
  • 中国积极开展空间探索活动 China has actively carried out space exploration missio
    近年来,中国积极开展空间探索活动,“嫦娥”揽月、“天问”探火、“羲和”逐日、空间站巡天,不断深化人类对宇宙的认知,致力增进人类共同福祉。Chinahasactivelycarriedoutspaceexplorationmissionsinrecentyears,includingthelaunchesofChang'elunarprobes,theMar......