| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我有一个极变态的方法,大家看看,好像是数论推的,因为a,b互质program zju1005;
var
a,b,t,n:longint;
begin
repeat
readln(a,b,n);
if b=1 then
begin
if n=1 then writeln('fill B');
writeln('success');
continue;
end;
if a=1 then
begin
for t:=1 to n do
begin
writeln('fill A');
writeln('pour A B');
end;
writeln('success');
continue;
end;
t:=0;
while t<>n do
begin
writeln('fill A');
writeln('pour A B');
inc(t,a);
if t>=b then
begin
dec(t,b);
writeln('empty B');
writeln('pour A B');
end;
end;
writeln('success');
until eof(input);
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator