比赛 20140714上午练习 评测结果 AAAAAAAAAA
题目名称 荷斯坦奶牛 最终得分 100
用户昵称 甘罗 运行时间 0.050 s
代码语言 Pascal 内存使用 0.03 MiB
提交时间 2014-07-14 10:11:13
显示代码纯文本

program zht;
var
v,g,i,j,b,k,zk,zhh,hh:integer;
x:array[1..25] of longint;
z:array[1..15,1..25] of longint;
zh,c,h,hz:array[1..30] of longint;
begin
assign(input,'holstein.in');
assign(output,'holstein.out');
reset(input);
rewrite(output);
readln(v);
for i:=1 to v do
read(x[i]);
readln(g);
for i:=1 to g do
begin
for j:=1 to v do
read(z[i,j]);
end;
zk:=500;
while c[g+1]<>1 do
begin
b:=0;
k:=0;
hh:=0;
for i:=1 to g do
zh[i]:=0;
c[1]:=c[1]+1;
for i:=1 to g do
if c[i]=2 then begin c[i]:=0;c[i+1]:=c[i+1]+1;end;
if c[g+1]=1 then break;
for i:=1 to v do
h[i]:=0;
for i:=1 to g do
if c[i]=1 then begin for j:=1 to v do h[j]:=h[j]+z[i,j];inc(k);zh[k]:=i;end;
for i:=1 to v do
begin
if h[i]<x[i] then b:=1;

end;
if b=0 then if k<zk then begin zk:=k;for i:=1 to g do hz[i]:=zh[i]; end
else if k=zk then for i:=1 to g do if zh[i]<hz[i] then hh:=1;
if hh=1 then for i:=1 to g do hz[i]:=zh[i];
end;
write(zk,' ');
for i:=1 to zk do
write(hz[i],' ');
close(input);
close(output);
end.

    program zht;
    var
    v,g,i,j,b,k,zk,zhh,hh:integer;
    x:array[1..25] of longint;
    z:array[1..15,1..25] of longint;
    zh,c,h,hz:array[1..30] of longint;
    begin
    assign(input,'holstein.in');
    assign(output,'holstein.out');
    reset(input);
    rewrite(output);
    readln(v);
    for i:=1 to v do
    read(x[i]);
    readln(g);
    for i:=1 to g do
    begin
    for j:=1 to v do
    read(z[i,j]);
    end;
    zk:=500;
    while c[g+1]<>1 do
    begin
    b:=0;
    k:=0;
    hh:=0;
    for i:=1 to g do
    zh[i]:=0;
    c[1]:=c[1]+1;
    for i:=1 to g do
    if c[i]=2 then begin c[i]:=0;c[i+1]:=c[i+1]+1;end;
    if c[g+1]=1 then break;
    for i:=1 to v do
    h[i]:=0;
    for i:=1 to g do
    if c[i]=1 then begin for j:=1 to v do h[j]:=h[j]+z[i,j];inc(k);zh[k]:=i;end;
    for i:=1 to v do
    begin
    if h[i]<x[i] then b:=1;

    end;
    if b=0 then if k<zk then begin zk:=k;for i:=1 to g do hz[i]:=zh[i]; end
    else if k=zk then for i:=1 to g do if zh[i]<hz[i] then hh:=1;
    if hh=1 then for i:=1 to g do hz[i]:=zh[i];
    end;
    write(zk,' ');
    for i:=1 to zk do
    write(hz[i],' ');
    close(input);
    close(output);
    end.

中文繁體 中文简体

2014-07-14 10:05:54 以 Twitter Bootstrap 作为界面框架,应用 spacelab 主题。 进程运行 0.0161 s ,处理完成数据库 9 次。
(站长统计)由 CmYkRgB123 在线评测系统 强力驱动,版本 2.8.2.0 ,由 王者自由 二次开发。原作者 ? BYVoid,保留部分权利。