您的位置:首页 > 其它

HDU1214--圆桌会议 HDU(90)

2013-08-11 15:30 204 查看
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int main(){
int n;
while(cin>>n)
{
int x,f,z;
f=n/2;
x=n-f;
z=f*(f-1)/2+x*(x-1)/2;
cout<<z<<endl;
}
return 0;
}

对于圆环来说,最好的办法就是对半分。

关于排序问题,就是1,2,3,4,5,6,->6,5,4,3,2,1即可,所以就是6冒泡上去,1冒泡下来。

圆环就是两段分别这么做,然后相加就好。

所以就1A。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: