最佳调度问题 Time Limit:10000MS Memory Limit:65536K Total Submit:89 Accepted:36 Case Time Limit:1000MS
来源:互联网 发布:vb游戏代码大全 编辑:程序博客网 时间:2024/05/18 00:40
var
ans,n,k,i,j:longint;
t,x:array[0..10000] of longint;
procedure machine(c,d:longint);
var max,e,f:longint;
begin
if d<ans then
begin
if c>n then ans:=d
else begin
for f:=1 to k do
begin
x[f]:=x[f]+t[c];
if x[f]>d then machine(c+1,x[f])
else machine(c+1,d);
x[f]:=x[f]-t[c];
end;
end;
end;
end;
begin
readln(n,k);
for i:=1 to n do read(t[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if t[i]<t[j] then
begin
t[0]:=t[i];
t[i]:=t[j];
t[j]:=t[0];
end;
i:=1;
while i<=n do
begin
ans:=ans+t[i];
i:=i+k;
end;
machine(1,0);
writeln(ans);
end.
ans,n,k,i,j:longint;
t,x:array[0..10000] of longint;
procedure machine(c,d:longint);
var max,e,f:longint;
begin
if d<ans then
begin
if c>n then ans:=d
else begin
for f:=1 to k do
begin
x[f]:=x[f]+t[c];
if x[f]>d then machine(c+1,x[f])
else machine(c+1,d);
x[f]:=x[f]-t[c];
end;
end;
end;
end;
begin
readln(n,k);
for i:=1 to n do read(t[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if t[i]<t[j] then
begin
t[0]:=t[i];
t[i]:=t[j];
t[j]:=t[0];
end;
i:=1;
while i<=n do
begin
ans:=ans+t[i];
i:=i+k;
end;
machine(1,0);
writeln(ans);
end.
0 1
- 最佳调度问题 Time Limit:10000MS Memory Limit:65536K Total Submit:89 Accepted:36 Case Time Limit:1000MS
- 【基础试题】矩阵问题 Time Limit:10000MS Memory Limit:65536K Total Submit:401 Accepted:267 Case Time Limit:1
- 【基础试题】回文数弱版 Time Limit:10000MS Memory Limit:65536K Total Submit:271 Accepted:87 Case Time Limit:1
- 【基础试题】约瑟夫环问题 Time Limit:1000MS Memory Limit:65536K Total Submit:426 Accepted:283 Description 有
- 【基础试题】兔子繁殖问题 Time Limit:1000MS Memory Limit:65536K Total Submit:674 Accepted:263 Description 有
- 【基础试题】输出杨辉三角的前N行 Time Limit:10000MS Memory Limit:65536K Total Submit:612 Accepted:319 Case Time L
- 【基础试题】求三个数的最大数 Time Limit:10000MS Memory Limit:65536K Total Submit:1262 Accepted:805 Case Time Li
- 【基础试题】蛇形矩阵 Time Limit:1000MS Memory Limit:65536K Total Submit:252 Accepted:118 Description 蛇形矩
- 【模拟试题】进制转换(normal) Time Limit:1000MS Memory Limit:65536K Total Submit:451 Accepted:203 Descriptio
- 【基础试题】排序(初级) Time Limit:1000MS Memory Limit:65536K Total Submit:1510 Accepted:672 Description
- 【基础试题】百钱买百鸡 Time Limit:1000MS Memory Limit:65536K Total Submit:1501 Accepted:441 Description 一
- 【基础试题】输出如下图形 Time Limit:1000MS Memory Limit:65536K Total Submit:604 Accepted:384 Description 输
- 【基础试题】faibonacci数列 Time Limit:1000MS Memory Limit:65536K Total Submit:1708 Accepted:453 Descripti
- 【基础试题】验证哥德巴赫猜想 Time Limit:1000MS Memory Limit:65536K Total Submit:566 Accepted:267 Description
- 【基础试题】数组元素的操作 Time Limit:1000MS Memory Limit:65536K Total Submit:441 Accepted:225 Description
- 【基础试题】求m与n之间的素数 Time Limit:1000MS Memory Limit:65536K Total Submit:1836 Accepted:572 Description
- //Sticks Time Limit: 1000MS Memory Limit: 10000K POJ//
- 排名 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submiss
- C编译器剖析_Github
- dubbo框架中一行日志代码引发的超时问题
- 消息队列RabbitMQ与Spring
- Android使用百度地图开发时,出现定位无反应。log里出现162错误代码
- pyqt5 打开文件
- 最佳调度问题 Time Limit:10000MS Memory Limit:65536K Total Submit:89 Accepted:36 Case Time Limit:1000MS
- [leetcode] 394. Decode String
- 学习笔记之JavaSE(49)--网络编程1
- php 不常见的读取文件的方法
- UVa 1151 Buy or Build
- 贝塞尔曲线
- postgreSQL的实用程序
- iOS 开发缓存机制之一内存缓存机制
- 做的最简单的APP-计数器