YT14-HDU-round-table conference, round-table conference
Members of the Problem DescriptionHDU ACM training team often discuss their problems during summer training. every time they face problems that they cannot solve, they will sit around a circular table and communicate with each other. After discussion, they generally cannot solve the problems, this is only a round-table meeting exclusive to the hdu acm training team. One day you can come and try it out. :) during the discussion, Eddy came up with an extremely strange idea, if they exchange seats for a pair of adjacent ACM players in each minute, how long will it take for them to obtain the order of seats in the opposite state? (That is, for each team member, the former team member on his left is later on his right, and the former team member on his right is on his left), of course it is difficult to find other smart team members, I will solve this odd problem right away. Do you know how to solve it?
Input for a given number of N (1 <= N <= 32767), it indicates that there are N people, and how long it takes to obtain the order of seats (reverse) opposite to the original state (for each person, the person on the left was on the right, and the person on the right was on the left.
Output outputs a row of data, indicating the time required (in minutes)
Sample Input
456
Sample Output
246
The Code is as follows:
# Include <iostream> using namespace std; int main () {int n, t, r; while (cin> n) {t = n/2; r = n-t; cout <t * (t-1)/2 + r * (r-1)/2 <endl;} return 0 ;}
Zookeeper