ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1051. Simple Game on a Grid

What's the algorithm to this problem?
Posted by Li Yi 7 Oct 2001 13:54
Re: What's the algorithm to this problem?
Posted by Hieu Nguyen 8 Oct 2001 00:50
> This is a my solution:
Suppose: m<=n
if m=1 then sol:=(n+1) div 2 else
begin
  if (m mod 3=0)or(n mod 3=0) then sol:=2 else sol:=1;
end;
How did you realise this algorithm?
Posted by Vinicius Fortuna 8 Oct 2001 04:17
How did you realise this algorithm?
How can you proof that?
This solution really impressed me! :-)
You may e-mail me: fortuna@acm.org

Thank you

> > This is a my solution:
> Suppose: m<=n
> if m=1 then sol:=(n+1) div 2 else
> begin
>   if (m mod 3=0)or(n mod 3=0) then sol:=2 else sol:=1;
> end;
>
Why after m and n mod 3, The situation havn't change? and the result either 1 or 2 ?
Posted by aaakkk 3 Mar 2002 07:55

>
> > > This is a my solution:
> > Suppose: m<=n
> > if m=1 then sol:=(n+1) div 2 else
> > begin
> >   if (m mod 3=0)or(n mod 3=0) then sol:=2 else sol:=1;
> > end;
> >