Roundtable
Time  limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 3356 Accepted Submission (s): 2351
Problem DESCRIPTIONHDU ACM Training team's team members often discuss their problems when they are in the summer camp. Whenever faced with a problem they could not solve, they would sit around a round table to communicate, after everyone's discussion there is generally no solution to the problem, This is only HDU ACM Training Team Special Round table, one day you can also come in to experience: "In the day during the discussion, Eddy came up with a very eccentric idea, if they in every minute, a pair of adjacent two ACM players exchange seats, So how long does it take to get the seat order opposite to the original state? (that is, for each member, the former player on his left later on his right, the player on his right is on his left side), which of course the other clever other teammates, immediately put this strange problem to solve, you know how to solve it?
Input for a given number of n (1<=n<=32767), indicates that there are n individuals, how long it takes to get a seat order opposite to the original state (reverse) for everyone, who was originally on his left and then on his right, who was on his left.
 
Output one row for each data, indicating the required time in minutes
Sample Input
55W
Sample Output
246
Authoreddy
Source
Hangzhou Electric ACM Province race Training Team Tryouts
Similar to bubbling sort: think of a table of people as a numbered ring, and then if you want him to reverse order, then you can put this ring, upside down can be, then there is in the process of left and right inversion, the ring is divided into
Two equal segments, both sides of the label exactly reversed, (as far as possible into equal two paragraphs).
Voidbubble_sort (INTA[],INTN)//n the number of elements of array a {    inti,j,temp;    for (j=0;j<n-1;j++) for        (i=0;i<n-1-j;i++)        {            if (a[i]>a[i+1])//array element size sorted in ascending order            {                temp=a[i ];                A[I]=A[I+1];                a[i+1]=temp;}}}        
Complexity of Timeif the initial state of the file is positive, a single scan will complete the sequencing. Number of keyword comparisons requiredand record the number of moveshave reached the minimum value:,. so the bubble sort the bestComplexity of Timeto be.
If the initial file is reversed, it needs to besort of a trip. The order of each trip is to be(1≤i≤n-1), and each comparison must move records three times to reach the Exchange record location. In this case, the comparison and the number of moves have reached the maximum value:the worst time complexity for bubbling sorting is. The overall average time complexity of the bubble sort is. 
AC Code:
#include <iostream>using namespace Std;int main () {int N;while (cin>>n) {int x,y;x=n/2;y=n-x;cout<< (x * (x-1)/2+y* (y-1)/2) <<endl;} return 0;}
Hangzhou Electric HDU ACM Roundtable