There are N people numbered from 1 to N around a round table. Everyone has a different number in their hands between 1 and N. We start with the first person and count the number in his hand and ask...


please use c++


There are N people numbered from 1 to N around a round table. Everyone has a different number in<br>their hands between 1 and N. We start with the first person and count the number in his hand and<br>ask the related person to leave the table. If the number in the card odd, we count clockwise. if it is<br>even, we count counterclockwise. Ensure that all people leave the table. The first person to leave the<br>table is the first person.<br>In the sample scenario, the first integer value in the table_in.txt file indicates the number of people<br>around the table, it is 5. The value of the card in the first person's hand is written on the next line, it is<br>3. The value of the second person's card is written on the next line, it is 1.<br>In the table_out.txt file, print the order of people leaving the table.<br>Sample scenario:<br>table in.txt<br>3<br>1<br>2<br>1<br>table out.txt<br>1<br>4<br>2|<br>3.<br>Constraints<br>N < 1<br>000 000<br>

Extracted text: There are N people numbered from 1 to N around a round table. Everyone has a different number in their hands between 1 and N. We start with the first person and count the number in his hand and ask the related person to leave the table. If the number in the card odd, we count clockwise. if it is even, we count counterclockwise. Ensure that all people leave the table. The first person to leave the table is the first person. In the sample scenario, the first integer value in the table_in.txt file indicates the number of people around the table, it is 5. The value of the card in the first person's hand is written on the next line, it is 3. The value of the second person's card is written on the next line, it is 1. In the table_out.txt file, print the order of people leaving the table. Sample scenario: table in.txt 3 1 2 1 table out.txt 1 4 2| 3. Constraints N < 1="" 000="">

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here