Var f1,f2:text; a,b,t,t1:integer; begin assign(f1,'input.txt'); reset(f1); assign(f2,'output.txt'); rewrite(f2); readln(f1,a,b,t); t1:= t mod (2*a+2*b); if (t1>=0)and(t1<a) then writeln(f2,'S') else if (t1>=a)and(t1<a+b) then writeln(f2,'E') else if (t1>=a+b)and(t1<2*a+b) then writeln(f2,'N') else writeln(f2,'W'); close(f1); close(f2); end.
Answers & Comments
Verified answer
Var f1,f2:text;a,b,t,t1:integer;
begin
assign(f1,'input.txt');
reset(f1);
assign(f2,'output.txt');
rewrite(f2);
readln(f1,a,b,t);
t1:= t mod (2*a+2*b);
if (t1>=0)and(t1<a) then writeln(f2,'S')
else if (t1>=a)and(t1<a+b) then writeln(f2,'E')
else if (t1>=a+b)and(t1<2*a+b) then writeln(f2,'N')
else writeln(f2,'W');
close(f1); close(f2);
end.