|
|
back to boardShow all messages Hide all messages> 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? 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; > > > > > 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; > > |
|
|