HAPPYTIC.PAS 872 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. Type TNum=record
  2. _1,_2,_3,_4,_5,_6 : integer;
  3. end;
  4. Var
  5. res : array [1..999] of Tnum;
  6. num : Tnum;
  7. curpos : word;
  8. t : text;
  9. Begin
  10. for curpos := 0 to 999 do with res[curpos] do
  11. begin
  12. _1:=-1;_2:=-1;_3:=-1;_4:=-1;_5:=-1;_6:=-1;
  13. end;
  14. curpos := 1;
  15. with num do begin
  16. for _1:=0 to 9 do
  17. for _3:=0 to 9 do
  18. for _2:=0 to 9 do
  19. for _4:=0 to 9 do
  20. for _5:=0 to 9 do
  21. if _1+_3+_5-_2-_4 in [0..9] then
  22. begin
  23. res[curpos] := num;
  24. res[curpos]._6 :=_1+_3+_5-_2-_4;
  25. inc(curpos);
  26. end;
  27. assign(t,'res.txt');
  28. rewrite(t);
  29. for curpos := 1 to 9999 do with res[curpos] do
  30. if _1 <> -1 then
  31. begin
  32. Write(t,_1,_2,_3,_4,_5,_6,' ');
  33. if curpos mod 10 = 0 then writeln(t,#13);
  34. end;
  35. end;
  36. Close(t);
  37. End.