Classmate Sort Description
The existing M-students, the 1th students for 1th, 2nd Students for 2nd, in turn, the first M-student is M. Ask the students to stand out, and then the rest of the re-composition, after the combination, once again let the students stand up, repeat n times, how many students come out to stand?
Example 1 Sample Input 1
1989 5
Sample Output 1
1926
Limit
1s
Tips
"Data Range"
1≤n≤10
100≤m≤100000
Title Link: https://vijos.org/p/1785
Analysis: The number of people standing out is even, if the total number is odd, the rest of the population up to take the whole again binary is good!
The AC code is given below:
1#include <bits/stdc++.h>2 using namespacestd;3 intMain ()4 {5 intn,m;6Cin>>n>>m;7 intI=1, ans=0;8 while(i<=m)9 {Teni++; Oneans+=n/2; AN= (n+1)/2; - } -cout<<ans<<Endl; the return 0; -}
Vijos P1785 Classmate Sort "simulation"