{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "cd1c7b8656184bc182464888f93f178a",
  "keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量",
  "title": "给出一个由O和X组成的串，长度为1~80，统计得分",
  "desc": [
    {
      "content": "\n给出一个由O和X组成的串，长度为1~80，统计得分，每个O的得分为目前连续出现的O的个数，X的得分为0，例如OOXXO的得分为1+2+0+0+1.",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include\"stdlib.h\"\n#include\"string.h\"\n#include\"stdio.h\"\nint main()\n{\n\tchar s[85];\n\tint score = 0,x;\n\tscanf(\"%s\",&s);\n\tfor (int i = 0;s[i];i++)\n\t{\n\t\tif (s[i] == 'X')\n\t\tscore += 0;\n\t\tif (s[i] == 'O')\n\t\t{\n\t\t\tint temp = 1;\n\t\t\tif (i == 0)score += 1;\n\t\t\telse\n\t\t\t{\n\t\t\t\tx=i;\n\t\t\t\twhile (x > 0)\n\t\t\t\t{\n\t\t\t\t\tif (s[x - 1] == 'O')temp++;\n\t\t\t\t\telse break; \n\t\t\t\t\tx--;\n\t\t\t\t}\n\t\t\t\tscore += temp;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", score);\n\tsystem(\"pause\");\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-81cb97919cb0454d898a43fe8d41f2db",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600469970"
}