RAZLFTRL.PAS 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Uses DOS;
  2. Var
  3. res : array [1..37] of longint;
  4. cursimple : longint;
  5. nums : longint;
  6. tmp : byte;
  7. num,j : longint;
  8. cur : longint;
  9. timestart,timeend,timetot : longint;
  10. hour,minute,second,sec100 : word;
  11. Procedure FindNextSimple;
  12. Var
  13. exitF : boolean;
  14. i : longint;
  15. Begin
  16. repeat
  17. ExitF := false;
  18. if cursimple in [1..2] then inc(cursimple) else inc(cursimple,2);
  19. for i := 2 to round(sqrt(cursimple)) do if cursimple mod i = 0 then ExitF := true;
  20. until not ExitF;
  21. End;{FindNextSimple}
  22. {--------------------------------}
  23. Begin
  24. Write('‚¢¥¤¨â¥ ç¨á«®: ');
  25. ReadLn(nums);
  26. GetTime(hour,Minute,Second,sec100);
  27. timestart := hour*3600;
  28. timestart := timestart+minute*60;
  29. timestart := timestart+second;
  30. for j := 2 to nums do
  31. begin
  32. cur := 1;
  33. cursimple := 1;
  34. num := j;
  35. While num <> 1 do
  36. begin
  37. FindNextSimple;
  38. while num mod cursimple = 0 do
  39. begin
  40. num := num div cursimple;
  41. res[cur] := cursimple;
  42. inc(cur);
  43. end;
  44. end;
  45. tmp :=1;
  46. While res[tmp] <> 0 do
  47. begin
  48. Write(res[tmp],' ');
  49. res[tmp] := 0;
  50. inc(tmp);
  51. end
  52. end;
  53. GetTime(hour,minute,second,sec100);
  54. timeend := hour*3600;
  55. timeend := timeend+minute*60;
  56. timeend := timeend+second;
  57. timetot := timeend - timestart;
  58. hour := timetot div 3600;
  59. timetot := timetot - hour*3600;
  60. minute := timetot div 60;
  61. timetot := timetot - minute*60;
  62. second := timetot;
  63. WriteLn;
  64. Write('‚à¥¬ï ¯à®áç¥â : ',Hour,' ç á®¢ ',Minute,' ¬¨­ãâ ',second,' ᥪ㭤');
  65. ReadLn
  66. End.