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 1053. Pinocchio

what they programme only use 60k memory with c++ ?
Posted by Aply 25 Jul 2005 18:27
 who know please tell me ?
give me a sample programme is the best!
Re: what they programme only use 60k memory with c++ ?
Posted by Aybek_TKTL 1 Feb 2006 16:22
var
  a:array[1..1000]of longint;
n,i,j:longint;

function nod(k,l:longint):longint;
begin
repeat
if k<l then l:=l mod k else k:=k mod l;
until (k=0)or(l=0);
nod:=k+l;
end;
begin
read(n);
for i:=1 to n do
read(a[i]);
for i:=n-1 downto 1 do
a[i]:=nod(a[i],a[i+1]);
write(a[1]);
end.