社区讨论
15分求助
P14914「QFOI R3」航线交汇参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mk6vwqk2
- 此快照首次捕获于
- 2026/01/09 21:00 上个月
- 此快照最后确认于
- 2026/01/11 20:00 上个月
CPP
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,d;
cin>>n>>d;
int s[n+1],t[n+1],h[n+1];
for(int i=0;i<n+1;i++)
{
cin>>s[i]>>t[i]>>h[i];
}
for(int i=1;i<n+1;i++)
{
if((abs(h[i]-h[0]))>d)
{
cout<<"No"<<endl;
}
else
{
if((s[i]<s[0]&&t[i]<t[0])||(s[i]>s[0]&&t[i]>t[0]))
{
cout<<"No"<<endl;
}
else if(s[i]==s[0]&&t[i]==t[0])
{
cout<<"Always"<<endl;
}
else
{
double x=(s[i]-s[0])/(t[0]-s[0]-t[i]+s[i]);
cout<<fixed<<setprecision(12)<<s[0]+x*(t[0]-s[0])<<endl;
}
}
}
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...