-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnow.cpp
32 lines (27 loc) · 807 Bytes
/
Snow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long
int main(void){
int testcase;
char s[1024];
scanf("%d", &testcase);
while(getchar() != '\n');
while(getchar() != '\n');
while(testcase--) {
gets(s);
double x1, y1, x2, y2;
double dist = 0;
while(gets(s) && s[0] != '\0') {
sscanf(s, "%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
dist += hypot(x1 - x2, y1 - y2);
}
dist = dist / 1000; // km
double hh = dist * 2 / 20; // * 2 (with one lane in each direction)
int mm = (int)round(hh * 60);
printf("%d:%02d\n", mm/60, mm%60);
if(testcase)
puts("");
}
return 0;
}