国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

1125. Chain the Ropes 解析

2019-11-06 06:39:20
字體:
來源:轉載
供稿:網友

排序從小到大累加打結就好了~~~

#include <iostream>#include <algorithm>#define MAX 10010using namespace std;int rope[MAX];int n;int main() {	cin >> n;	for (int i = 0; i < n; i++) {		cin >> rope[i];	}	sort(rope, rope + n);	int max = rope[0];	int link = rope[0];	bool tag = false;	for (int i = 1; i < n; i++) {		link += rope[i];		link /= 2;	}	cout << link << endl;		return 0;}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 资溪县| 虞城县| 枣庄市| 定州市| 通海县| 霍邱县| 蓬莱市| 铜陵市| 湖北省| 忻州市| 历史| 甘德县| 兴隆县| 沂南县| 潼南县| 钟祥市| 登封市| 禹州市| 漳平市| 碌曲县| 通城县| 东城区| 津南区| 金门县| 边坝县| 丁青县| 巴马| 扎鲁特旗| 射阳县| 镇坪县| 屯留县| 灵丘县| 涞源县| 柯坪县| 阜康市| 鱼台县| 赤峰市| 漯河市| 白玉县| 柯坪县| 微博|