fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. enum class Operator{
  5. None,
  6. Plus,
  7. Minus,
  8. Multi,
  9. Div,
  10. Mod,
  11. Wall,
  12. Max,
  13. };
  14.  
  15. static const int Top = 0;
  16. static const int Right = 1;
  17. static const int Bottom = 2;
  18. static const int Left = 3;
  19.  
  20. struct Wall{
  21. Operator Op;
  22. double Value;
  23. bool IsWalked;
  24. };
  25.  
  26. struct Floor{
  27. /* * /
  28. int Top;
  29. int Right;
  30. int Bottom;
  31. int Left;
  32. /* */
  33. int Dir[4];
  34.  
  35. Floor(int Top_, int Right_, int Bottom_, int Left_){
  36. Dir[0] = Top_;
  37. Dir[1] = Right_;
  38. Dir[2] = Bottom_;
  39. Dir[3] = Left_;
  40. }
  41. };
  42.  
  43. struct FootPrint{
  44. //-------
  45. };
  46.  
  47. typedef std::pair<std::vector<std::vector<Floor>>,std::vector<Wall>> Map;
  48.  
  49. Map MakeData(){
  50. std::vector<Wall> WallData = {
  51. { Operator::Minus, 2, false }, { Operator::Plus, 5, false }, { Operator::Minus, 1, false }, { Operator::Plus, 3, false }, { Operator::Plus, 2, false }, { Operator::Minus, 1, false },///
  52. { Operator::Plus, 1, false }, { Operator::Plus, 3, false }, { Operator::Plus, 2, false }, { Operator::Minus, 1, false }, { Operator::Plus, 2, false }, { Operator::Minus, 1, false }, { Operator::Plus, 3, false },///
  53. { Operator::Plus, 1, false }, { Operator::Plus, 4, false }, { Operator::Multi, 2, false }, { Operator::Minus, 1, false }, { Operator::Plus, 4, false }, { Operator::Minus, 2, false },///
  54. { Operator::Plus, 4, false }, { Operator::Plus, 2, false }, { Operator::Plus, 1, false }, { Operator::Plus, 3, false }, { Operator::Plus, 3, false }, { Operator::Plus, 5, false }, { Operator::Minus, 1, false },///
  55. { Operator::Plus, 3, false }, { Operator::Plus, 2, false }, { Operator::Minus, 1, false }, { Operator::Plus, 4, false }, { Operator::Plus, 1, false }, { Operator::Multi, 3, false },///
  56. { Operator::Minus, 2, false }, { Operator::Minus, 1, false }, { Operator::Minus, 1, false }, { Operator::Plus, 5, false }, { Operator::Minus, 1, false }, { Operator::Minus, 2, false }, { Operator::Plus, 2, false },///
  57. { Operator::Plus, 4, false }, { Operator::Minus, 1, false }, { Operator::Plus, 3, false }, { Operator::Minus, 2, false }, { Operator::Plus, 5, false }, { Operator::Plus, 1, false },///
  58. { Operator::Plus, 3, false }, { Operator::Plus, 5, false }, { Operator::Plus, 4, false }, { Operator::Minus, 1, false }, { Operator::Plus, 2, false }, { Operator::Plus, 2, false }, { Operator::Plus, 1, false },///
  59. { Operator::Minus, 2, false }, { Operator::Multi, 3, false }, { Operator::Plus, 1, false }, { Operator::Plus, 2, false }, { Operator::Minus, 1, false }, { Operator::Plus, 3, false },///
  60. { Operator::Minus, 1, false }, { Operator::Plus, 1, false }, { Operator::Minus, 2, false }, { Operator::Plus, 4, false }, { Operator::Plus, 4, false }, { Operator::Plus, 1, false }, { Operator::Minus, 2, false },///
  61. { Operator::Plus, 5, false }, { Operator::Plus, 1, false }, { Operator::Plus, 3, false }, { Operator::Minus, 1, false }, { Operator::Multi, 2, false }, { Operator::Plus, 4, false },///
  62. { Operator::Plus, 1, false }, { Operator::Plus, 2, false }, { Operator::Plus, 2, false }, { Operator::Minus, 2, false }, { Operator::Plus, 1, false }, { Operator::Plus, 5, false }, { Operator::Plus, 3, false },///
  63. { Operator::Plus, 3, false }, { Operator::Minus, 1, false }, { Operator::Plus, 2, false }, { Operator::Plus, 4, false }, { Operator::Minus, 2, false }, { Operator::Plus, 1, false },///
  64. };
  65. std::vector<std::vector<Floor>> FloorData = {//これは自動生成できそうだけど、わからん。脳弱になるー。うぎゃーーーー!!!上下幅は7*7で13。
  66. { { -1, 0, 6, -1 }, { -1, 1, 7, 0 }, { -1, 2, 8, 1 }, { -1, 3, 9, 2 }, { -1, 4, 10, 3 }, { -1, 5, 11, 4 }, { -1, -1, 12, 5 }, },
  67. { { 6, 13, 19, -1 }, { 7, 14, 20, 13 }, { 8, 15, 21, 14 }, { 9, 16, 22, 15 }, { 10, 17, 23, 16 }, { 11, 18, 24, 17 }, { 12, -1, 25, 18 }, },
  68. { { 19, 26, 32, -1 }, { 20, 27, 33, 26 }, { 21, 28, 34, 27 }, { 22, 29, 35, 28 }, { 23, 30, 36, 29 }, { 24, 31, 37, 30 }, { 25, -1, 38, 31 }, },
  69. { { 32, 39, 45, -1 }, { 33, 40, 46, 39 }, { 34, 41, 47, 40 }, { 35, 42, 48, 41 }, { 36, 43, 49, 42 }, { 37, 44, 50, 43 }, { 38, -1, 51, 44 } },
  70. { { 45, 52, 58, -1 }, { 46, 53, 59, 52 }, { 47, 54, 60, 53 }, { 48, 55, 61, 54 }, { 49, 56, 62, 55 }, { 50, 57, 63, 56 }, { 51, -1, 64, 57 }, },
  71. { { 58, 65, 71, -1 }, { 59, 66, 72, 65 }, { 60, 67, 73, 66 }, { 61, 68, 74, 67 }, { 62, 69, 75, 68 }, { 63, 70, 76, 69 }, {64,-1,77,70}, },
  72. { { 71, 78, -1, -1 }, { 72, 79, -1, 78 }, { 73, 80, -1, 79 }, { 74, 81, -1, 80 }, { 75, 82, -1, 81 }, { 76, 83, -1, 82 }, {77,-1,-1,83}, },
  73. };
  74.  
  75. return std::make_pair(FloorData,WallData);
  76. }
  77.  
  78. bool ShowMap(Map& M,bool ViewType = true ){
  79. bool F2 = false;
  80.  
  81. for (auto& oo : M.first){
  82. if (ViewType == true){
  83. std::cout << " ";
  84. for (auto& o : oo){
  85. if (o.Dir[Right] == -1)continue;
  86. if (M.second[o.Dir[Right]].Op == Operator::Plus) std::cout << '+';
  87. if (M.second[o.Dir[Right]].Op == Operator::Minus) std::cout << '-';
  88. if (M.second[o.Dir[Right]].Op == Operator::Multi) std::cout << '*';
  89. if (M.second[o.Dir[Right]].Op == Operator::Div) std::cout << '/';
  90. std::cout << M.second[o.Dir[Right]].Value << " ";
  91. }
  92. std::cout << std::endl;
  93. for (auto& o : oo){
  94. if (o.Dir[Bottom] == -1)continue;
  95. if (M.second[o.Dir[Bottom]].Op == Operator::Plus) std::cout << '+';
  96. if (M.second[o.Dir[Bottom]].Op == Operator::Minus) std::cout << '-';
  97. if (M.second[o.Dir[Bottom]].Op == Operator::Multi) std::cout << '*';
  98. if (M.second[o.Dir[Bottom]].Op == Operator::Div) std::cout << '/';
  99. std::cout << M.second[o.Dir[Bottom]].Value << " ";
  100. }
  101. std::cout << std::endl;
  102. }
  103. else{
  104. for (auto& o : oo){
  105. if (o.Dir[Top] == -1)continue;
  106. F2 = true;
  107. if (M.second[o.Dir[Top]].Op == Operator::Plus) std::cout << '+';
  108. if (M.second[o.Dir[Top]].Op == Operator::Minus) std::cout << '-';
  109. if (M.second[o.Dir[Top]].Op == Operator::Multi) std::cout << '*';
  110. if (M.second[o.Dir[Top]].Op == Operator::Div) std::cout << '/';
  111. std::cout << M.second[o.Dir[Top]].Value << " ";
  112. }
  113. if(F2 == true) std::cout << std::endl;
  114. for (auto& o : oo){
  115. if (o.Dir[Left] == -1)continue;
  116. std::cout << " ";
  117. if (M.second[o.Dir[Left]].Op == Operator::Plus) std::cout << '+';
  118. if (M.second[o.Dir[Left]].Op == Operator::Minus) std::cout << '-';
  119. if (M.second[o.Dir[Left]].Op == Operator::Multi) std::cout << '*';
  120. if (M.second[o.Dir[Left]].Op == Operator::Div) std::cout << '/';
  121. std::cout << M.second[o.Dir[Left]].Value;
  122. }
  123. std::cout << std::endl;
  124.  
  125.  
  126. }
  127. }
  128.  
  129. return 0;
  130. }
  131.  
  132. int main(){
  133.  
  134. auto M = MakeData();
  135. ShowMap(M);
  136. std::cout << std::endl;
  137. ShowMap(M, false);
  138. return 0;
  139.  
  140. }
  141.  
Success #stdin #stdout 0s 3484KB
stdin
Standard input is empty
stdout
  -2  +5  -1  +3  +2  -1  
+1  +3  +2  -1  +2  -1  +3  
  +1  +4  *2  -1  +4  -2  
+4  +2  +1  +3  +3  +5  -1  
  +3  +2  -1  +4  +1  *3  
-2  -1  -1  +5  -1  -2  +2  
  +4  -1  +3  -2  +5  +1  
+3  +5  +4  -1  +2  +2  +1  
  -2  *3  +1  +2  -1  +3  
-1  +1  -2  +4  +4  +1  -2  
  +5  +1  +3  -1  *2  +4  
+1  +2  +2  -2  +1  +5  +3  
  +3  -1  +2  +4  -2  +1  


  -2  +5  -1  +3  +2  -1
+1  +3  +2  -1  +2  -1  +3  
  +1  +4  *2  -1  +4  -2
+4  +2  +1  +3  +3  +5  -1  
  +3  +2  -1  +4  +1  *3
-2  -1  -1  +5  -1  -2  +2  
  +4  -1  +3  -2  +5  +1
+3  +5  +4  -1  +2  +2  +1  
  -2  *3  +1  +2  -1  +3
-1  +1  -2  +4  +4  +1  -2  
  +5  +1  +3  -1  *2  +4
+1  +2  +2  -2  +1  +5  +3  
  +3  -1  +2  +4  -2  +1