Pagini recente » Clasament Grigore Moisil 2010, clasele 7-8 | Rating Pop Sebastian Paul (sebpopica) | Cod sursa (job #63045) | Cod sursa (job #1536485) | Cod sursa (job #266476)
Cod sursa(job #266476)
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 99999 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.