Назад к лучшим решениям Status: AC, problem ZTM, contest ZEL07. By ding0 (NETALL), 2007-03-15 18:16:27.
  1. const
  2. mas : array [1..10] of string = ('dada', 'dadi', 'daum',
  3. 'dida', 'didi', 'dium',
  4. 'umda', 'umdi', 'umum', 'shsh');
  5.  
  6. procedure WriteOne(S1 : Integer; C1 : string; S2 : Integer; C2, M : string);
  7. begin
  8. writeln(s1, ' ', c1, ' ', s2, ' ', c2, ' ', m);
  9. end;
  10.  
  11. procedure WriteAll(S1 : Integer; S2 : Integer; M : string; AllowSh : Boolean);
  12. var
  13. i : integer;
  14. begin
  15. for i := 1 to 9 do
  16. begin
  17. writeln(s1, ' ', mas[i], ' ', s2, ' ', mas[i], ' ', m);
  18. end;
  19.  
  20. if allowSh then
  21. writeln(s1, ' ', mas[10], ' ', s2, ' ', mas[10], ' ', m);
  22. end;
  23.  
  24. begin
  25. // umda
  26. WriteOne(000, 'umda', 001, 'umda', 'um');
  27. WriteOne(001, 'umda', 000, 'umda', 'da');
  28.  
  29. // umum
  30. writeln('000 umum 001 umum um');
  31. writeln('001 umum 002 umum um');
  32. writeln('002 umum 600 umum da');
  33.  
  34. // dada
  35. writeln('000 dada 000 dada da'); // 00 - is ok
  36.  
  37. // 102 - propusk 2
  38. WriteAll(102, 101, 'da', false);
  39.  
  40. // 101 - propusk 1
  41. WriteAll(101, 600, 'da', false);
  42.  
  43. // didi
  44. writeln('000 didi 702 didi di');
  45.  
  46. // dida
  47. writeln('000 dida 702 dida di');
  48.  
  49. // daum
  50. writeln('000 daum 300 daum da');
  51.  
  52. // 300 - pause
  53. WriteAll(300, 000, 'um', true);
  54.  
  55. // dadi
  56. writeln('000 dadi 401 dadi da');
  57. writeln('400 dadi 600 dadi da');
  58.  
  59. // 401 - nazad na 1
  60. WriteAll(401, 400, 'di', true); // false - ok
  61.  
  62. // umdi
  63. writeln('000 umdi 001 umdi um');
  64. writeln('001 umdi 600 umdi da');
  65.  
  66. // dium
  67. writeln('000 dium 300 daum da');
  68.  
  69. // Sostoyaniye da
  70. /////////////////////////////////////////////////////////////////
  71.  
  72. writeln('600 dada 000 dada da');
  73.  
  74. writeln('600 dadi 000 dadi da');
  75.  
  76. writeln('600 daum 601 daum um');
  77.  
  78. writeln('600 dida 000 dida da');
  79.  
  80. writeln('600 didi 000 didi da');
  81.  
  82. writeln('600 dium 601 dium um');
  83.  
  84. writeln('600 umda 001 umda um');
  85.  
  86. writeln('600 umdi 001 umda um');
  87.  
  88. writeln('600 umum 001 umum um');
  89.  
  90. WriteAll(601, 600, 'da', false);
  91.  
  92. // Sostoyaniye 2 da
  93. ////////////////////////////////////////////////////////////////
  94. WriteOne(700, 'dada', 000, 'dada', 'da'); // 000 - ok
  95.  
  96. WriteOne(700, 'dadi', 000, 'dadi', 'da');
  97.  
  98. WriteAll(702, 701, 'da', true);
  99. WriteAll(701, 600, 'da', false); // damn!!
  100.  
  101. WriteOne(700, 'daum', 701, 'daum', 'um');
  102.  
  103. WriteOne(700, 'dida', 702, 'dida', 'di');
  104.  
  105. WriteOne(700, 'didi', 702, 'didi', 'di');
  106.  
  107. WriteOne(700, 'dium', 703, 'dium', 'di');
  108. WriteAll(703, 702, 'um', true);
  109.  
  110. WriteOne(700, 'umda', 001, 'umda', 'um');
  111.  
  112. WriteOne(700, 'umdi', 001, 'umda', 'um');
  113.  
  114. WriteOne(700, 'umum', 001, 'umum', 'um');
  115. end.