Pagini recente » Cod sursa (job #461941) | Cod sursa (job #563076) | Atasamentele paginii Profil roadtojedi | Cod sursa (job #3157643) | Cod sursa (job #23112)
Cod sursa(job #23112)
var x,i,n,s,y,a,b:longint;
begin
assign(input,'sum.in');reset(input);
assign(output,'sum.out');rewrite(output);
readln(n);
for i:=1 to n do begin
read(x);s:=0;
for y:=1 to 2*x do begin
a:=y;
b:=x;
while (a<>b) do
if (a>b) then a:=a-b
else b:=b-a;
if (a=1)then s:=s+y;
end;
writeln(s);
end;
close(input);close(output);
end.