P1542 80pts求调
  • 板块灌水区
  • 楼主MaCity
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/1/23 10:37
  • 上次更新2025/1/23 13:33:57
查看原帖
P1542 80pts求调
1214197
MaCity楼主2025/1/23 10:37
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5; 
struct node{
	int x,y,z;
}a[N];
int n;
bool check(double mid){
	double time=0.0;
	for(int i=1; i<=n; i++){
		time+=a[i].z/mid;
		if(time>a[i].y)return false;
		if(time<a[i].x)time=a[i].x;
	}
	return true;
}
int main(){
	cin>>n;
	for(int i=1; i<=n; i++){
		cin>>a[i].x>>a[i].y>>a[i].z;
	}
	double l=0.0,r=1e9,ans;
	while(r-l>=1e-10){
		double mid=(l+r)/2.0;
		if(check(mid)){
			r=mid;
		}else{
			l=mid;
		}
	}
	printf("%0.2lf",l);
	return 0;
}

TLE #7 #10

后来变量改为long double

都输出0.00

2025/1/23 10:37
加载中...