Pagini recente » Rating Grigorosoaia Florin (Praetor) | Cod sursa (job #2324052) | Cod sursa (job #1822291) | Cod sursa (job #2998741) | Cod sursa (job #266471)
Cod sursa(job #266471)
function test(n:integer):integer;
begin
test:=0;
if (n mod 100=25) or (n mod 100=50) or (n mod 100=75) then test:=2
else if (n mod 10=5) or (n mod 10=0) then test:=1;
end;
var i,j,k,c:longint;
begin
assign(input,'fact.in');
assign(output,'fact.out');
reset(input);
rewrite(output);
readln(k);
c:=0;
for i:=1 to 9999 do begin
c:=c+test(i);
if c>k then j:=-1;
if c=k then begin j:=i; break; end;
end;
if k=0 then write(1) else write(j);
readln;
close(input);
close(output);
end.