71分求助
  • 板块P1577 切绳子
  • 楼主wendidago
  • 当前回复1
  • 已保存回复1
  • 发布时间2025/8/4 19:27
  • 上次更新2025/8/5 09:22:24
查看原帖
71分求助
750917
wendidago楼主2025/8/4 19:27
#include<bits/stdc++.h> 
using namespace std;
long long b,c,d,e=0;
int	a[10005],l=1,r=1000000;
long double g;
int main(){
	cin>>b>>c;
		for(int i=1;i<=b;i++){
		cin>>g;
		g*=100;
		a[i]=int(g);
	}
	while(l<r){
		e=0;
		int m=(l+r+1)/2;
		for(int i=1;i<=b;i++){
			e+=a[i]/m;
		}
		if(e>=c){
			l=m;
		}else{
			r=m-1;	
		}
	}
	printf("%.2f",l*1.0/100.0);
}     
2025/8/4 19:27
加载中...