zoj 1730 || poj 1455 Crazy Tea Party(= =)
2010-11-07 13:48
459 查看
开始不会写,看人家思路了 = = YM.。
按照冒泡排序的思想,时间为n*(n-1)/2
因为是个环,可以将n分成两部分进行排序。
然后将时间累加即可 = =。。。。啊呀呀。。
按照冒泡排序的思想,时间为n*(n-1)/2
因为是个环,可以将n分成两部分进行排序。
然后将时间累加即可 = =。。。。啊呀呀。。
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> using namespace std; int main(void) { int ncases,n,times; cin >> ncases; while( ncases-- ) { cin >> n; times = n/2*(n/2-1)/2+(n-n/2)*(n-n/2-1)/2; cout << times; if( ncases ) cout << endl; } return 0; }
相关文章推荐
- zoj 1730 / poj 1455 Crazy Tea Party
- zoj 1730 / poj 1455 Crazy Tea Party
- poj 1455 Crazy tea party
- ZOJ 1730 Crazy Tea Party
- poj 1455 Crazy tea party
- zoj 1730 Crazy Tea Party
- zoj 1730 - Crazy tea party
- POJ 1455 Crazy tea party
- POJ 1455 Crazy tea party 冒泡排序的想法
- ZOJ Problem Set - 1730 Crazy Tea Party
- POJ_1455_Crazy tea party_解题思路
- poj1455——Crazy tea party
- poj 1455 Crazy tea party
- zoj 1730 Crazy Tea Party(水题吗?我不会啊!!!)
- ZOJ 1730 Crazy Tea Party
- poj 1455 Crazy tea party
- POJ_1455_Crazy tea party_解题思路
- zoj 1730 Crazy Tea Party
- poj 1455-Crazy tea Party-类似冒泡排序
- zoj1730-----------------Crazy Tea Party