The code you circled is the statement that outputs the results. This means that there is no space before the first output number, and each subsequent number adds a space to the previous number. first is a flag bit. It is first assigned a value of 1 and is judged during the loop output. At this time, first=1, which is the first result output. Then print the result directly and set first to 0. Then print the subsequent output. At this time, first=0 (not the first number), then output a space first and then print the number.
1 5 6 7 in the example is actually 1[space]5[space]6[space]7[space]
If it is the first unfolded light (first is true), only modify the flag bit to false (do not output " ") and then output the number of the light. If it is not the first displayed light (judge whether it is the first displayed light) first has been set to 0), first output " " and then the number
The code you circled is the statement that outputs the results. This means that there is no space before the first output number, and each subsequent number adds a space to the previous number.
first is a flag bit. It is first assigned a value of 1 and is judged during the loop output. At this time, first=1, which is the first result output. Then print the result directly and set first to 0. Then print the subsequent output. At this time, first=0 (not the first number), then output a space first and then print the number.
1 5 6 7 in the example is actually 1[space]5[space]6[space]7[space]
If it is the first unfolded light (first is true), only modify the flag bit to false (do not output " ") and then output the number of the light. If it is not the first displayed light (judge whether it is the first displayed light) first has been set to 0), first output " " and then the number
....Isn’t this just to use spaces to divide the resulting numbers....
Otherwise they would all be connected 1567