fork(2) download
  1. const fi='';
  2. fo='';
  3. oo=3000000;
  4. var k,t,i,j,tt:longint;
  5. tam,n,res:qword;
  6. f:text;
  7. tmp:array[2..oo] of boolean;
  8. ngto:array[1..oo] of longint;
  9. d :longint;
  10. function max(a,b:qword):qword;
  11. begin
  12. if a>b then exit(a) else exit(b);
  13. end;
  14. procedure xl;
  15. var i,j :longint;
  16. begin
  17. for i:=1 to d-k+1 do
  18. begin
  19. tam :=1;
  20. for j:=i to i+k-1 do
  21. begin
  22. tam := tam*ngto[j];
  23. end;
  24. if tam>n then break else res := max(res,tam);
  25. end;
  26. end;
  27. procedure init;
  28. begin
  29. for i:=2 to trunc(sqrt(oo)) do
  30. if tmp[i]=false then
  31. begin
  32. j:=i*i;
  33. while j<=oo do
  34. begin
  35. tmp[j]:=true;
  36. j:=j+i;
  37. end;
  38. end;
  39. d:=0;
  40. for i:=2 to oo do
  41. if tmp[i]=false then begin inc(d); ngto[d]:=i; end;
  42. j:=d;
  43. end;
  44. procedure nhap;
  45. begin
  46. assign(f,fi);reset(f);
  47. assign(output,fo);rewrite(output);
  48. read(f,t);
  49. for tt:=1 to t do
  50. begin
  51. read(f,n,k);
  52. res := 0;
  53. xl;
  54. if res=0 then writeln(-1) else writeln(res);
  55. end;
  56. close(f);close(output);
  57. end;
  58. begin
  59. init;
  60. nhap;
  61. end.
Success #stdin #stdout 0.06s 4524KB
stdin
Standard input is empty
stdout
Standard output is empty