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 1224. Spiral

what is WA 6 my solition is here
Posted by zzzlll 11 Jan 2007 12:21
var
s,n,m,y:extended;
begin
readln(n,m);
if m<n then begin
 if m=1 then writeln('1')
  else begin
  s:=3;
  y:=0;
  if m<>2 then
  repeat
  y:=y+1;
  m:=m-1;
  until m<=2;
writeln(s+(y*2):0:0);
 end;
 end
else if (n=m) or (m>n) then begin
  if n=2 then writeln('2')
  else if n=1 then writeln('1')
   else begin
  s:=1;
  repeat
  s:=s+1;
  n:=n-1;
  until n<=2;
writeln(2*s:0:0);
  end;
end;
end.