- 接水问题
- 2016-05-07 09:00:15 @
var
a:array[1..120] of longint;
i,b,n,m,k,mx,j:longint;
begin
readln(n,m);
for i:=1 to n do
begin
read(b);
k:=1;
for j:=2 to m do
if a[j]<a[k] then k:=j;
a[k]:=a[k]+b;
end;
mx:=0;
for i:=1 to m do
if a[i]>mx then mx:=a[i];
writeln(mx);
end.
2 条评论
-
sbsbsb LV 4 @ 2016-05-08 13:45:42
var a:array[1..120] of longint;
b,i,k,j,n,m,x:longint;
begin
readln(n,m);
for i:=1 to m do read(a[i]);
for i:=m+1 to n do
begin
read(b);
k:=1;
for j:=2 to m do
if a[j]<a[k] then k:=j;
a[k]:=a[k]+b;
end;
x:=0;
for i:=1 to m do
if a[i]>x then x:=a[i];
writeln(x);
end. -
2016-05-08 13:45:41@
var a:array[1..120] of longint;
b,i,k,j,n,m,x:longint;
begin
readln(n,m);
for i:=1 to m do read(a[i]);
for i:=m+1 to n do
begin
read(b);
k:=1;
for j:=2 to m do
if a[j]<a[k] then k:=j;
a[k]:=a[k]+b;
end;
x:=0;
for i:=1 to m do
if a[i]>x then x:=a[i];
writeln(x);
end.
- 1
信息
- ID
- 1811
- 难度
- 4
- 分类
- (无)
- 标签
- 递交数
- 1852
- 已通过
- 785
- 通过率
- 42%
- 被复制
- 15
- 上传者