蒟蒻75分求助(DALAO壶关)
查看原帖
蒟蒻75分求助(DALAO壶关)
1237628
YCW13983841648楼主2024/9/18 18:43

75分代码求助QAQ #5 WA了

#include<bits/stdc++.h>
#define int long long
using namespace std;
struct Node{
	double d,p;
}a[10];
priority_queue<Node>p;
int n;
double d1,c,d2,ans;
bool operator<(Node x,Node y){
	return x.p>y.p;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>d1>>c>>d2>>a[1].p>>n;
	a[1].d=0;
	for(int i=2;i<=n+1;i++){
		cin>>a[i].d>>a[i].p;
	}
	a[n+2].d=d1;
	int i=1;
	while((a[i+1].d-a[i].d)<=c*d2&&i<=n+1){
		p.push(a[i]);
		ans+=(a[i+1].d-a[i].d)/d2*p.top().p;
		i++;
	}
	if(i==n+2){
		printf("%.2lf",ans);
	}
	else{
		printf("No Solution");
	}
	return 0;
}
2024/9/18 18:43
加载中...