solution.json 1.7 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "08eb0ca1decd4be9b59ef5822951ccdf",
  "keywords": "B树,算法高阶,高级数据结构,B树上的基本操作",
  "title": "请问一共可以有多少种取木棍的方案",
  "desc": [
    {
      "content": "\n目前有一个长度为 n 的木棍,当做直角三角形的斜边。A,B,C要从许多整数长度的木棍中选出三根,分别长为 a, b, c。 现在,蒜头君和花椰妹的木棍组成一条直角边长度为 a + b,白菜君组成另外一条直角边 c,并且要求 a + b ≤ c。请问一共可以有多少种取木棍的方案。 提示:a = 3, b = 4 与 a = 4, b = 3 算作同一种方案。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <stdio.h>\nint main()\n{\n\tint n;\n\tint cnt = 0;\n\tscanf(\"%d\", &n);\n\tfor (int a = 1; a < n; a++)\n\t\tfor (int b = a; b < n - a; b++)\n\t\t\tfor (int c = 1; c < n; c++)\n\t\t\t{\n\t\t\t\tif ((a+b)*(a+b)+c*c==n*n)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"a=%d b=%d c=%d\\n\", a, b, c);\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\tprintf(\"一共有%d种方案\", cnt);\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-0cef0ea9a9464eb8acb4a439fde7c351",
  "license": "csdn.net",
  "created_at": 1637894158,
  "topic_link": "https://bbs.csdn.net/topics/600469852"
}