solution.json 2.0 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": "18d1a3976bb4424bb4d8fae27a8de3f5",
  "keywords": "算法初阶,排序和顺序统计量,中位数和顺序统计量",
  "title": "工龄问题求解,工龄 人数",
  "desc": [
    {
      "content": "\n<p>给定公司N名员工的工龄&#xff0c;要求按工龄增序输出每个工龄段有多少员工。输入首先给出正整数N&#xff0c;即员工总人数&#xff1b;\n随后给出N个整数&#xff0c;即每个员工的工龄&#xff0c;范围在[0, 99]。其中&#xff0c;0-9为第1个工龄段&#xff0c;10-19为第2个工龄段&#xff0c;…&#xff0c;90-99为第10个工龄段。按工龄的递增顺序输出每个工龄的员工个数&#xff0c;格式为&#xff1a;“工龄:人数”。每项占一行。如果人数为0则不输出该项。</p>",
      "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 i,n,a[11]= {0},x;\n\tscanf(\"%d\",&n);\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\tif(x<=9)\n\t\t\ta[1]++;\n\t\telse if(x>9&&x<=19)\n\t\t\ta[2]++;\n\t\telse if(x>19&&x<=29)\n\t\t\ta[3]++;\n\t\telse if(x>29&&x<=39)\n\t\t\ta[4]++;\n\t\telse if(x>39&&x<=49)\n\t\t\ta[5]++;\n\t\telse if(x>49&&x<=59)\n\t\t\ta[6]++;\n\t\telse if(x>59&&x<=69)\n\t\t\ta[7]++;\n\t\telse if(x>69&&x<=79)\n\t\t\ta[8]++;\n\t\telse if(x>79&&x<=89)\n\t\t\ta[9]++;\n\t\telse\n\t\t\ta[10]++;\n\t}\n\tfor(i=1;i<=10;i++){\n\t\tif(a[i]>0){\n\t\t\tprintf(\"%d-%d:%d\\n\",i*10-10,i*10-1,a[i]);\n\t\t}\n\t}\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-194ea4a62b2448fdb6199ff24fe4b792",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470245"
}