3 条题解
-
3
#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; }
-
2
#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; 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; }
- 1
信息
- ID
- 64
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- (无)
- 递交数
- 89
- 已通过
- 36
- 上传者