[Huawei Computer Test Real Questions Java] How many communities do the children come from?

  Table of contents

Question description

Enter description

Output description

Reference example

Reference Code

Computer test introduction

write at the end


Question description

Kindergarten organizes activities, and the teacher assigns a task:

Each child should find out how many children there are in the same community as him.

We aggregate these quantities into the array garden.

Based on the information given by these children, please calculate at least how many communities the children in the class come from?

Enter description

Input: garden[] = {2, 2, 3}

Output description

Output: 7

Remark

  • The maximum length of the garden array is 999
  • The maximum number of children in each community is 1000, that is, the range of garden[i] is [0, 9

Guess you like

Origin blog.csdn.net/forest_long/article/details/135425929