65分求助大佬!!!
  • 板块P1577 切绳子
  • 楼主yekc2010
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/3/26 22:12
  • 上次更新2024/3/27 13:39:53
查看原帖
65分求助大佬!!!
1127771
yekc2010楼主2024/3/26 22:12

wa #4 #7 #9 #10 #11

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
double a[11000];
int n,k;
bool c(int x){
	int ans=0;
	for(int i=1;i<=n;i++){
		ans+=a[i]/x;
	}
	return ans<k;
}
int main(){
    IOS;
	int l=0,r=100000,mid;
	double xyx;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>xyx;
		a[i]=int(xyx*100);
	}
	while(l<=r){
		mid=l+r>>1;
		if(mid==0) break;
		if(c(mid)){
            r=mid-1;
		}
		else l=mid+1;
	}
	printf("%.2lf",r/100.0);
	return 0;
}


2024/3/26 22:12
加载中...