{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "90d989a6c03b4d1190c2a5a512d4c3bb",
  "keywords": "图算法,算法高阶,图的表示,基本的图算法",
  "title": "卖树苗",
  "desc": [
    {
      "content": "\n<pre><p>题目描述\n植树节又到了,商家A和商家B为了卖出更多的树苗。<br />\n商家A有了新的决定&#xff1a;<br />\n购买树苗数量小于等于10棵&#xff0c;所有树苗按正常价格10元一棵收费&#xff1b;<br />\n购买树苗数量大于10且小于等于20棵&#xff0c;超出10棵以上的树苗按8.2元一棵收费&#xff0c;其余树苗按正常价格收费&#xff1b;<br />\n购买树苗数量大于20棵&#xff0c;超出20棵以上的树苗按7.5元一棵收费&#xff0c;10至20棵部分树苗按8.2元一棵收费&#xff0c;其余树苗按正常价格收费。<br />\n商家B决定&#xff1a;<br />\n所有树苗12元一棵&#xff0c;但是均打七折卖出。</pre><pre>图图要代表班级去买树苗&#xff0c;要求输入图图需要购买的树苗棵数&#xff0c;输出在哪家商家购买更加划算及其所要花费的钱数。\n输入要求\n1 行,一个整数&#xff0c;表示图图需要购买的树苗数量。\n输出要求\n1 行,如果商家A的树苗比较划算&#xff0c;输出&#xff1a;A&#xff0c;否则输出&#xff1a;B&#xff0c;同时输出图图购买树苗最优惠的钱数&#xff08;文字和数字间用空格隔开&#xff09;。</pre>\n样例输入 </p>\n<pre>\n30</pre>\n<p>样例输出 </p>\n<pre>\nB 252</pre>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <iostream>\nusing namespace std;\nint main() {\n\tdouble n, A, B;\t\n\tcin >> n;\n\tB = 12 * 0.7 * n;\n\tif (n <= 10) {\n\t\tA = 10 * n;\n\t}\n\telse if (n > 10 && n <= 20) {\n\t\tA = 10 * 10 + (n - 10) * 8.2;\n\t}\n\telse {\n\t\tA = 10 * 8.2 + (n - 20) * 7.5 + 10 * 10;\n\t}\n\tif (A < B) {\n\t\tcout << \"A \" << A;\n\t}\n\telse {\n\t\tcout << \"B \" << B;\n\t}\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-7f4aaca343fc40549296badcaa53bf03",
  "license": "csdn.net",
  "created_at": 1637894158,
  "topic_link": "https://bbs.csdn.net/topics/600469866"
}