早教吧作业答案频道 -->英语-->
英语翻译RanklistSortingYouaregiventhescoresofseveralplayersinacompetition.Yourtaskistocreatearanklistoftheplayers,sortedindecreasingorderbyscore.Unfortunately,thedatastructureusedforthelistofplayerssupportsonlyo
题目详情
英语翻译
Ranklist Sorting
You are given the scores of several players in a competition.Your task is to create a ranklist of the
players,sorted in decreasing order by score.
Unfortunately,the data structure used for the list of players supports only one operation,which
moves a player from position i to position j without changing the relative order of other players.If
i > j,the positions of players at positions between j and i − 1 increase by 1,otherwise if i < j the
positions of players at positions between i + 1 and j decrease by 1.
This operation takes i steps to locate the player to be moved,and j steps to locate the position
where he or she is moved to,so the overall cost of moving a player from position i to position j is
i + j.Here,positions are numbered starting with 1.
Determine a sequence of moves to create the ranklist such that the sum of the costs of the moves is
minimized.
Input
The input is read from a text file named sorting.in .The first line contains n (2
Ranklist Sorting
You are given the scores of several players in a competition.Your task is to create a ranklist of the
players,sorted in decreasing order by score.
Unfortunately,the data structure used for the list of players supports only one operation,which
moves a player from position i to position j without changing the relative order of other players.If
i > j,the positions of players at positions between j and i − 1 increase by 1,otherwise if i < j the
positions of players at positions between i + 1 and j decrease by 1.
This operation takes i steps to locate the player to be moved,and j steps to locate the position
where he or she is moved to,so the overall cost of moving a player from position i to position j is
i + j.Here,positions are numbered starting with 1.
Determine a sequence of moves to create the ranklist such that the sum of the costs of the moves is
minimized.
Input
The input is read from a text file named sorting.in .The first line contains n (2
▼优质解答
答案和解析
Ranklist排序
让用户有分数几名球员在竞争.你的任务是创造一个ranklist的
播放器,依次排序的评分.
不幸的是,数据结构用于支持名单的球员只有一个行动,
动作的球员从第一的位置不改变立场j的相对秩序的其他球员.如果
字母i “ J以来,立场球员之间的立场J和我- 1增加1 ,否则,如果我”的j
位置球员之间的立场一+ 1和J减少1 .
此操作步骤,字母i需要找到球员移动,和J步骤定位
他或她是搬到,所以总的成本移动位置的球员从第一的位置J的
一+学者在这里,职位的编号从1 .
确定序列的动作创造ranklist的款项等的费用,此举是
减少到最低限度.
输入
输入读取一个文本文件名为sorting.in .第一行包含ñ ( 2 “为N ” = 1000 ) ,
球员的数量.以下每个ñ行包含一个非负整数硅( 0 “ =市” =
1000000 ) ,得分球员在目前的秩序.你可以假设所有分数是不同的.
输出
输出写入一个文本文件名为sorting.out .第一行中的打印输出
一些动作用于创建ranklist .以下几行应指定动作的
为了在被应用.每个移动应予以说明的行包含两个整数字母i
和J ,这意味着球员的位置移动到第一的位置学者数字I和J必须
分隔的一个空间.
例如
sorting.in sorting.out
分级
30 %的测试案例有价值观的N “ = 10
让用户有分数几名球员在竞争.你的任务是创造一个ranklist的
播放器,依次排序的评分.
不幸的是,数据结构用于支持名单的球员只有一个行动,
动作的球员从第一的位置不改变立场j的相对秩序的其他球员.如果
字母i “ J以来,立场球员之间的立场J和我- 1增加1 ,否则,如果我”的j
位置球员之间的立场一+ 1和J减少1 .
此操作步骤,字母i需要找到球员移动,和J步骤定位
他或她是搬到,所以总的成本移动位置的球员从第一的位置J的
一+学者在这里,职位的编号从1 .
确定序列的动作创造ranklist的款项等的费用,此举是
减少到最低限度.
输入
输入读取一个文本文件名为sorting.in .第一行包含ñ ( 2 “为N ” = 1000 ) ,
球员的数量.以下每个ñ行包含一个非负整数硅( 0 “ =市” =
1000000 ) ,得分球员在目前的秩序.你可以假设所有分数是不同的.
输出
输出写入一个文本文件名为sorting.out .第一行中的打印输出
一些动作用于创建ranklist .以下几行应指定动作的
为了在被应用.每个移动应予以说明的行包含两个整数字母i
和J ,这意味着球员的位置移动到第一的位置学者数字I和J必须
分隔的一个空间.
例如
sorting.in sorting.out
分级
30 %的测试案例有价值观的N “ = 10
看了 英语翻译RanklistSo...的网友还看了以下:
将字母组成单词,并译成汉语1.m,e,r,m,u,s,汉语2.u,l,t,e,c,u,r,汉语3. 2020-06-04 …
纵横字谜之英语暑假作业题(s)(o)(r)(r)(n)(g)(r)(e))(a)(k)(k)(e) 2020-06-06 …
已知y^(n-1)=e^x*(sin2x),求y^(n+1) 2020-06-11 …
已知函数y=(e^x-a)^2+(e^(-x)-a)^2(a属于R,a不等于0),求y的最小值Y= 2020-07-21 …
写单词,这些单词打乱顺序了!:1.d,f,e,n,i,f,e,r,t,()2.g,h,o,e,t, 2020-07-26 …
已知曲线上一点(x,y),过该点做曲线的法向量n,切向量t.请问为什么cos(n,x)=cos(t 2020-07-30 …
求柱面的方程..准线为f(x,y)=0,z=0;母线的方向向量为s={l,m,n},则柱面的方程f 2020-07-31 …
关于参数方程的问题1.x=e^t+e^(-t)y=2(e^t-e^(-t))e=2.71828(t 2020-08-02 …
已知(1+1/x)^x=e,e^x-1=x,limx→1(x+x^2+...+x^n-n)/(x-1 2020-10-31 …
二、看拼音,写词语。èyùn()tángcí()duòjiǎo()gēyáo()kuàbāo()dà 2020-12-15 …