Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我有一个极变态的方法,大家看看,好像是数论推的,因为a,b互质

Posted by linmeng at 2005-08-07 20:11:07 on Problem 1606
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator