2 条题解
-
0
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(0); int n;cin>>n; double x,y;cin>>x>>y; double ans=1e18; for(int i=1;i<=n;i++) { double a,c;cin>>a>>c; double b=-1; double d=fabs((a*x+b*y+c)/sqrt(a*a+b*b)); ans=min(ans,d); } cout<<fixed<<setprecision(2)<<ans; return 0; } -
0
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(0); int n;cin>>n; double x,y;cin>>x>>y; double ans=1e18; for(int i=1;i<=n;i++) { double a,c;cin>>a>>c; double b=-1; double d=fabs((a*x+b*y+c)/sqrt(a*a+b*b)); ans=min(ans,d); } cout<<fixed<<setprecision(2)<<ans; return 0; }
- 1
信息
- ID
- 978
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 10
- 标签
- 递交数
- 6
- 已通过
- 5
- 上传者