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

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

POJ 1064 Cable master

2019-11-08 01:47:06
字體:
來源:轉載
供稿:網友

經典二分

AC代碼:

#include <iostream>#include <cstdio> #include <cstring> #include <cstdlib>#include <cmath>#include <algorithm> using namespace std; int n, k;double a[10005]; bool judge(double x){ int cnt = 0; for(int i = 0; i < n; i++){ cnt += (int)(a[i]/x); if(cnt >= k) return true; } return false;}int main(){ scanf("%d %d", &n, &k); double maxa = 0; for(int i = 0; i < n; i++){ scanf("%lf", &a[i]); maxa = max(maxa, a[i]); } double lb = 0, ub = maxa; for(int i = 0; i < 100; i++){ double mid = (ub + lb)/2.0; if(judge(mid)) lb = mid; else ub = mid; }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄂托克旗| 精河县| 永德县| 余姚市| 洪雅县| 西乌珠穆沁旗| 喀喇| 定远县| 治县。| 自治县| 徐闻县| 永川市| 安徽省| 青浦区| 泾阳县| 莒南县| 锦州市| 区。| 高青县| 阜康市| 武夷山市| 保亭| 宁都县| 皋兰县| 武清区| 托克托县| 邵阳县| 巨野县| 泉州市| 米泉市| 榕江县| 康定县| 聊城市| 宁陕县| 竹北市| 仁布县| 嫩江县| 泸溪县| 南江县| 赤壁市| 三亚市|