开始以为是DP,但是仔细一想,动作k创造的价格只取决于它第一次出现的时间Sk和最后一次出现的时间Ek,则它创造的价值只可能为(Ek+Sk)*Ck。所以我们每次找最大价值的动作放在两侧直到放不下为止。
program p2697; var x:array[1..500] of longint; i,j,k,n,k1,max,where,tot:longint; begin readln(n,k); for i:=1 to k do read(x[i]); k1:=n+1; tot:=0; for i:=1 to k do begin k1:=k1-2; if k1<=0 then break; max:=-1; for j:=1 to k do if max<x[j] then begin max:=x[j]; where:=j; end; x[where]:=-1; tot:=tot+k1*max; end; writeln(tot); end.
2022年9月09日 01:48
Formative Assessment means not only an examination, it includes various aspects such as Examination in completed lessons, Reflections, Project work done on the allotted topic and Self also Prepared notes etc. AP SSC fa 1 Model Paper Candidates of Telugu Medium, English Medium & Urdu Medium of the AP State can download the AP 10th Class FA 4 Model Paper 2023 Pdf with answers for the regular exams conducted by the Directorate of Government Examinations, Andhra Pradesh.
2023年2月01日 00:26
This is an interesting approach to the problem of Dynamic Programming. Instead of solving the problem in the traditional way, the proposed solution rests on the idea that the price created by an best place to buy diamond rings action only depends on the time of its first and last appearances. By putting the action with the greatest value on both sides every time, it becomes possible to maximize the price created. This is a clever and efficient approach that is worth exploring further.