CHIHUIZY @ 2024-11-04 17:27:15
#include<bits/stdc++.h>
using namespace std;
double sum;
int main(){
int n;cin>>n;
double m=0;
double x,y,t;
int p;
for(int i=1;i<=n;i++)
{
cin>>x>>y>>p;
m=sqrt(abs(x)*abs(x)+abs(y)*abs(y));
t=m/50+p+m/50+p*0.5;
sum+=t;
cout<<(int)ceil(sum);
}
return 0;
}
by niuchenyue @ 2024-11-04 21:00:56
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
scanf("%d", &n);
double sum = 0;
for (int i = 1; i <= n; i++){
double x, y;//注意是 double 类型
int p;
scanf("%lf%lf%d", &x, &y, &p);
double dis = sqrt(x * x + y * y);
sum += dis / 50 + p + dis / 50 + p * 0.5;
//船往返的时间总和
}
printf("%d\n", int(ceil(sum)));//向上取整函数
return 0;
}
by niuchenyue @ 2024-11-04 21:03:14
感谢CartesianTree__
by CHIHUIZY @ 2024-11-11 15:54:44
@niuchenyue 我最近没空,今天才看到,谢谢,我将总时间看成了救援各个屋顶的人的的时间了