Pagini recente » Cod sursa (job #1432002) | Istoria paginii runda/simoni199/clasament | Cod sursa (job #993341) | Istoria paginii runda/juniori_1 | Cod sursa (job #30141)
Cod sursa(job #30141)
{$ASMMODE intel}
var a,i,j,c:longint;
f:text;
function lnko(a,b:longint):longint;assembler;
asm
{ push ax
push dx
shr al,1
jc @ize
shr dl,1
jc @ize
pop dx
pop ax
mov al,2
jmp @kii
@ize: }
@ciklus:
cmp eax,edx
jb @kisebb
sub eax,edx
jmp @vege
@kisebb:
sub edx,eax
@vege:
cmp eax,0
je @na
cmp edx,0
je @kii
cmp eax,edx
jne @ciklus
jmp @kii
@na:
xchg eax,edx
@kii:
end;
begin
assign(f,'fractii.in');
reset(f);
read(f,a);
close(f);
c:=0;
{ for i:=2 to a do
for j:=2 to a do
if lnko(i,j)=1 then inc(c);}
asm
mov eax,[a]
@eleje:
mov ecx,[a]
@ciklus:
mov edx,ecx
push eax
call lnko
cmp eax,1
jne @kov
inc [c]
@kov:
dec ecx
pop eax
cmp ecx,0
jne @ciklus
dec eax
cmp eax,0
jne @eleje
end;
assign(f,'fractii.out');
rewrite(f);
write(f,c);
close(f);
end.