Home > Back-end >  New solution!!!!!!
New solution!!!!!!

Time:10-10

During outbreaks, must avoid crowds gathered, some classmates are going to use computer programs to die
To: there are 100 meters long runway m people, some facing left, some facing right, each
People can only walk along the runway, the speed is 1 m/SEC, when two people meet, they would at the same time,
Turned around and went away in the opposite direction, these people, there are 1 people infected with the new type of coronavirus,
When and meet other people, the coronavirus infection to encounter people, please calculate,
When everyone left the runway, how many people are infected with the new type of coronavirus,
[] input format the first line of input an integer m (1 & lt; M<25), said the total number, then the
A line are separated by Spaces integers Ai (- 100 & lt; AiSaid the distance of the track on the left endpoint, greater than zero to the right, facing left, less than zero said data
Not allowed to appear in the value 0, also does not allow two people to take up the same position, among them, the first
Data on behalf of the people already carry virus,
Output format output as an integer, represent the number of people infected with the virus that new champions finally,
[input sample]
5
8-10-12 20
[output sample]
3

CodePudding user response:

Just answered a similar question before, to make reference to modify it
https://bbs.csdn.net/topics/396053574
  • Related