fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. const string PINC = "たのしー!";
  6. const string PDEC = "たーのしー!";
  7. const string INC = "すごーい!";
  8. const string DEC = "すっごーい!";
  9. const string PUT = "なにこれなにこれ!";
  10. const string GET = "おもしろーい!";
  11. const string START = "うわー!";
  12. const string END = "おもしろーい!";
  13.  
  14. /*
  15. const string PINC = ">";
  16. const string PDEC = "<";
  17. const string INC = "+";
  18. const string DEC = "-";
  19. const string PUT = ".";
  20. const string GET = ",";
  21. const string START = "[";
  22. const string END = "]";
  23. */
  24.  
  25. public static void Main()
  26. {
  27. Print("Friends");
  28. }
  29.  
  30. private static int Put(char c, int cur = 0)
  31. {
  32. var diff = c - cur;
  33.  
  34. var ope = (diff > 0) ? INC : DEC;
  35. var sqrt = (int)Math.Sqrt(Math.Abs(diff));
  36. var x = sqrt + 1;
  37. var y = sqrt;
  38. var offset = diff - x * y;
  39.  
  40. if (offset < 0) { offset += y; x--; }
  41.  
  42. // optimize
  43. for (var i = 1; i < x - 1; ++i)
  44. {
  45. var tmp = diff - (sqrt + i) * (sqrt + i);
  46. if (0 <= tmp && tmp < offset)
  47. {
  48. x = sqrt + i;
  49. y = sqrt - i;
  50. offset = tmp;
  51. }
  52. }
  53.  
  54. if (diff < (x + y + 3))
  55. {
  56. Console.Write(PINC);
  57. for (var i = 0; i < Math.Abs(diff); ++i)
  58. Console.Write(ope);
  59. Console.Write(PUT);
  60. Console.Write(PDEC);
  61. return c;
  62. }
  63.  
  64. // set a repeat number
  65. for (var i = 0; i < x; ++i)
  66. Console.Write(INC);
  67.  
  68. // loop start
  69. Console.Write(START);
  70.  
  71. Console.Write(PINC);
  72. for (var i = 0; i < y; ++i)
  73. Console.Write(ope);
  74.  
  75. // loop decriment
  76. Console.Write(PDEC);
  77. Console.Write(DEC);
  78.  
  79. // loop end
  80. Console.Write(END);
  81.  
  82. Console.Write(PINC);
  83. for (var i = 0; i < offset; ++i)
  84. Console.Write(ope);
  85.  
  86. // output
  87. Console.Write(PUT);
  88.  
  89. Console.Write(PDEC);
  90.  
  91. return c;
  92. }
  93.  
  94. private static int Print(string str, int cur = 0)
  95. {
  96. foreach (var c in str)
  97. cur = Put(c, cur);
  98. return cur;
  99. }
  100. }
Success #stdin #stdout 0.01s 131776KB
stdin
Standard input is empty
stdout
すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!うわー!たのしー!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!たーのしー!すっごーい!おもしろーい!たのしー!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!なにこれなにこれ!たーのしー!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!うわー!たのしー!すごーい!すごーい!すごーい!すごーい!すごーい!すごーい!たーのしー!すっごーい!おもしろーい!たのしー!すごーい!すごーい!なにこれなにこれ!たーのしー!たのしー!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!なにこれなにこれ!たーのしー!たのしー!すっごーい!すっごーい!すっごーい!すっごーい!なにこれなにこれ!たーのしー!すごーい!すごーい!すごーい!うわー!たのしー!すごーい!すごーい!すごーい!たーのしー!すっごーい!おもしろーい!たのしー!なにこれなにこれ!たーのしー!たのしー!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!すっごーい!なにこれなにこれ!たーのしー!すごーい!すごーい!すごーい!すごーい!うわー!たのしー!すごーい!すごーい!すごーい!たーのしー!すっごーい!おもしろーい!たのしー!すごーい!すごーい!すごーい!なにこれなにこれ!たーのしー!