比赛 NOIP2008集训模拟2 评测结果 AWAWWWWWWW
题目名称 美酒节赛羊 最终得分 20
用户昵称 打不死的羊 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-11 10:08:34
显示代码纯文本
program goat;
var
f1,f2:text;
i,t,p,s,pmax:longint;
procedure man;
begin
t:=t+1;
s:=s-1;
p:=p+1;
end;
procedure zhong;
begin
t:=t+1;
s:=s-5;
p:=p-2;
end;
procedure kuai;
begin
t:=t+1;
s:=s-10;
p:=p-5;
end;
{.....................................}
begin
assign(f1,'goat.in');
assign(f2,'goat.out');
reset(f1);rewrite(f2);
readln(f1,s,p);
pmax:=p;
{.....................................}
if p<10 then begin while s>0 do
                    begin
                    if p>pmax then p:=pmax;
                    if p=0 then begin for i:=1 to 10 do begin man;if s<=0 then break;end;end
                           else begin if p div 5<>0 then kuai
                                                    else if p div 2<>0 then zhong
                                                    else begin man;if (s>0)and(p<=pmax) then zhong;end;
                                end;
                    end;
              end
         else begin
while s>0 do
begin
if p=0 then man
       else begin
            if p=10 then begin if s<=20 then begin kuai;if s>0 then kuai;end
                                        else for i:=1 to 5 do zhong;
                         end
                    else begin if p div 5<>0 then kuai
                                             else if p div 2<>0 then zhong
                                                                else begin man;if s>0 then zhong;end;
                         end;
            end;
end;
end;
writeln(f2,t);
close(f1);close(f2);
end.