算法训练 蜜蜂飞舞
作者:互联网
code
#include<iostream>
#include<algorithm>
#include<complex>
#include<cstring>
using namespace std;
const int N=10000;
double a[N],b[N],c[N],d[N],e[N],f[N],t[N];//array t mean fly time
int main(){
ios::sync_with_stdio(false);
int n=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i]>>t[i];
}
double x1,y1,z1,x2,y2,z2;
cin>>x1>>y1>>z1>>x2>>y2>>z2;
for(int i=0;i<n;i++){
x1+=a[i]*t[i];
y1+=b[i]*t[i];
z1+=c[i]*t[i];
x2+=d[i]*t[i];
y2+=e[i]*t[i];
z2+=f[i]*t[i];
}
printf("%.4lf",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2)));
return 0;
}
标签:y2,飞舞,int,x1,x2,算法,蜜蜂,y1,include 来源: https://www.cnblogs.com/jeseesmith/p/15860996.html