1 条题解
-
0
C :
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { long long start, endd; long long x1, y1, x2, y2; double dis = 0; scanf("%d%d",&start,&endd); while(scanf("%lld%lld%lld%lld",&x1,&y1,&x2,&y2) != EOF){ dis += sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); } double ans = dis * 2 / 1000 / 20; long long h = (long long)ans; long long m = (long long)((ans - h) * 60 + 0.5); printf("%lld:%02lld",h,m); return 0; }
C++ :
#include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> using namespace std; long double solve(int,int,int,int); int mround(long double); int startx,starty,endx,endy; unsigned int h,m; long double tot = 0; int main() { cin>>startx>>starty; while (cin>>startx>>starty>>endx>>endy) tot += solve(startx,starty,endx,endy); h = floor(tot) - 1; m = mround(60 * (tot - h)); if (m >= 60) { m -= 60; h++; } cout<<h<<":"; if (m < 10) cout<<"0"; cout<<m<<endl; return 0; } long double solve(int a,int b,int c,int d) { long double x,y; x = abs(a - c); y = abs(b - d); return sqrt(x * x + y * y) / 10000; } int mround(long double inp) { if (inp - floor(inp) >= 0.5) return floor(inp) + 1; else return floor(inp); }
- 1
信息
- ID
- 2111
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者