Solución al problema número 10281 de UVA - 10281.

Cualquier duda no dudes en contactar.

#include <bits/stdc++.h>
#define INF 0x3F3F3F3F
using namespace std;

int main() {
   
    char str[90];
    int hh, mm, ss;
    double ans = 0, ltime = 0, rtime, v = 0;
    while(gets(str))
    {
        sscanf(str, "%d:%d:%d", &hh, &mm, &ss);
        rtime = hh + mm/60.0 + ss/3600.0;
        if(str[8] == '\0') {
            ans += (rtime-ltime)*v;
            printf("%s %.2lf km\n", str, ans);
        } else {
            ans += (rtime-ltime)*v;
            sscanf(str+8, "%lf", &v);
        }
        ltime = rtime;
    }
    return 0;
}

No te pierdas nada.

Sigue en contacto con Isaac Lozano Osorio!