杜晨路牛逼


私信TA

用户名:cbjsgmm1108

访问量:1851

签 名:

等  级
排  名 33693
经  验 410
参赛次数 0
文章发表 3
年  龄 0
在职情况 学生
学  校 浙江科技学院
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<cstdio>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int n;

int ai, bi, ci, di, ei, fi, ti;

int x1 = 0, y1 = 0, z1 = 0, x2 = 0, y2 = 0, z2 = 0;

scanf("%d", &n);

for (int i = 0; i <= n; i++)

{

cin >> ai >> bi >> ci >> di >> ei >> fi;

if (i == n)

ti = 1;

else

cin >> ti;

x1 += ai * ti;

y1 += bi * ti;

z1 += ci * ti;

x2 += di * ti;

y2 += ei * ti;

z2 += fi * ti;

}

double ans = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1));

printf("%.4lf", ans);

system("pause");

return 0;

}


 

0.0分

4 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区