算法训练 蜜蜂飞舞

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;
}
上一篇:java中Scanner类的使用方法


下一篇:【记录】白吃小学生知识点记录