{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n\"Same\"游戏是一个在10*15的盘面上进行的单人游戏。开始时,每个格子内有一个球,其颜色为红色(R)、绿色(G)或蓝色(B)。颜色相同,且能通过上下左右相连成块的多个球为一组球。在游戏中,玩家每次选择组内球数不少于2的组并移除组内所有的球。然后,盘面会按如下两步骤进行变换:\n\u003cbr\u003e 1. 每列中剩余的球从上往下掉落以填满空格。(球的顺序不变)\n\u003cbr\u003e 2. 如果有空列的话,将剩余各列向左移动以尽可能地填满左边的列。列间的顺序不变。\n\u003cbr\u003e比如说,选择消除下图中左下角的球所在组会导致如下结果:\n \u003cbr\u003e\n \u003cimg SRC\u003d\"CDN_BASE_URL/180fe98f1dcd4ab1f5f14e43bad852ff?v\u003d1534268589\"\u003e \n \u003cbr\u003e这个游戏的目标是移除盘面内所有的球。游戏在盘面内没有球或每组球都只有一个时结束。计分规则如下:玩家初始分数为0.当移除一组球时,玩家获得(m-2)^2分,其中m是组内球的个数。如果成功清除所有的球的话还会得到额外1000分。\n \u003cbr\u003e你猜测每次移除尽可能多的球数是一种好方案,因此你想写程序模拟一下这一策略。注:如果多组球并列组内球数最大的话,选择组内最靠左的球最靠左的组。如果继续并列,选择这些最靠左的球中最靠下的球所在组。 \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n输入数据包括多组测试数据。\n输入的第一行为组数。\n每组测试数据共有10行,每行15个字符描述了盘面的初始状态。\n每组测试数据前有空行。(原文如此)\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n对于每组测试数据,第一行输出组号,然后空一行。接下来按如下格式输出每次操作: \u003cbr\u003eMove x at (r,c): removed b balls of color C, got s points. \n \u003cbr\u003e其中,x是操作编号,r和c分别是行号和列号。各行按1到10从下到上编号,各列按1到15从左到右编号。b是被移除的球的数量。C代表本次移除的球的颜色。s是本次操作的得分(不包含1000分移除所有球的奖分) \n \u003cbr\u003e最终得分以如下形式输出: \n \u003cbr\u003eFinal score: s, with b balls remaining. \n \u003cbr\u003e每组数据之间空一行。\n\u003cbr\u003e即使对应的数值为1,也请使用复数形式\"balls\"和\"points\"。 \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e3 \nRGGBBGGRBRRGGBG \nRBGRBGRBGRBGRBG\nRRRRGBBBRGGRBBB\nGGRGBGGBRRGGGBG\nGBGGRRRRRBGGRRR\nBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBB\nRRRRRRRRRRRRRRR\nRRRRRRGGGGRRRRR\nGGGGGGGGGGGGGGG\n\nRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRR\nGGGGGGGGGGGGGGG\nGGGGGGGGGGGGGGG\nBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBB\nRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRR \nGGGGGGGGGGGGGGG\nGGGGGGGGGGGGGGG\n\nRBGRBGRBGRBGRBG\nBGRBGRBGRBGRBGR\nGRBGRBGRBGRBGRB\nRBGRBGRBGRBGRBG\nBGRBGRBGRBGRBGR\nGRBGRBGRBGRBGRB\nRBGRBGRBGRBGRBG\nBGRBGRBGRBGRBGR\nGRBGRBGRBGRBGRB\nRBGRBGRBGRBGRBG\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003eGame 1: \n\nMove 1 at (4,1): removed 32 balls of color B, got 900 points. \nMove 2 at (2,1): removed 39 balls of color R, got 1369 points. \nMove 3 at (1,1): removed 37 balls of color G, got 1225 points. \nMove 4 at (3,4): removed 11 balls of color B, got 81 points. \nMove 5 at (1,1): removed 8 balls of color R, got 36 points. \nMove 6 at (2,1): removed 6 balls of color G, got 16 points. \nMove 7 at (1,6): removed 6 balls of color B, got 16 points. \nMove 8 at (1,2): removed 5 balls of color R, got 9 points. \nMove 9 at (1,2): removed 5 balls of color G, got 9 points. \nFinal score: 3661, with 1 balls remaining. \n\nGame 2: \n\nMove 1 at (1,1): removed 30 balls of color G, got 784 points. \nMove 2 at (1,1): removed 30 balls of color R, got 784 points. \nMove 3 at (1,1): removed 30 balls of color B, got 784 points. \nMove 4 at (1,1): removed 30 balls of color G, got 784 points. \nMove 5 at (1,1): removed 30 balls of color R, got 784 points. \nFinal score: 4920, with 0 balls remaining. \n\nGame 3: \n\nFinal score: 0, with 150 balls remaining. \u003c/pre\u003e"}}]}