- 接水问题
- 2016-05-07 09:01:13 @
var
m,n,b,c,d,r,f,g,h,j,i,mx,k:longint;
a:array[1..120]of 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.
7 条评论
-
huangzheng LV 9 @ 2016-05-08 13:58:54
吃屎吧,还有更好的算法,直接数学
-
2016-05-08 13:45:47@
傻子啊
-
2016-05-08 13:45:22@
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:13@
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-07 10:33:23@
// input code here
-
2016-05-07 09:02:58@
你是不是傻
-
2016-05-07 09:02:56@
你是不是傻
- 1
信息
- ID
- 1811
- 难度
- 4
- 分类
- (无)
- 标签
- 递交数
- 1852
- 已通过
- 785
- 通过率
- 42%
- 被复制
- 15
- 上传者