#include #include #include #include ifstream in("average.in"); int main () { assert(in); int n, t, h, m, s; double d; char c1, c2; in >> n >> d; while (in >> t) { cout << setw(3) << t << ": "; int i=n; int o=0; double total=0; while (i--) { in >> ws; if (in.peek()=='-') { string trash; getline(in, trash); cout << '-' << endl; goto err; } in >> h >> c1 >> m >> c2 >> s; total += (3600 * h + 60 * m + s); } o = (int)(total / d + 0.5); cout << (o / 60) << (o%60<10 ? ":0" : ":") << (o%60) << " min/km" << endl; err:; } }