#include <bits/stdc++.h>
#define dbug(x) cout << '>' << #x << ':' << x << endl
#define dbg(x) cout << '>' << #x << ':' << x << " "
#define pline cout << "_________________________" << endl
#define mem(x, v) memset(x, v, sizeof(x))
#define eef else if
#define sf scanf
#define pf printf
#define i64 long long
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define lla(x) x.rbegin(), x.rend()
#define SORT(c) sort(all(c))
#define ssort(v) stable_sort(v.begin(), v.end())
#define sz(v) (int)(v).size()
#define IT iterator
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define contains(T, x) (T.find(x) != T.end())
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(max(a,max(b,c)),d)
#define Reverse(x) reverse(x.begin(),x.end())
#define loop(i,s,e) for(__typeof(s) i=(s);i<=(e);i++)
#define pool(i,e,s) for(__typeof(e) i=(e);i>=(s);i--)
#define FORIT(i, m) for (__typeof((m).begin()) i=(m).begin(); i!=(m).end(); ++i)
#define newl '\n'
// 12345678901234567890
#define MAX 1e5
#define Fast ios_base::sync_with_stdio(0)
using namespace std;
int main(){
//Fast;
char time[20]="";
double speed = 0 , current = 0 , prev = 0 , dis;
while(sf("%s",time)!=EOF){
double h , m , s;
char c;
sscanf(time,"%lf:%lf:%lf",&h,&m,&s);
current = (h*3600)+(m*60)+s;
dis += (current - prev)*(speed/3600.0);
c = getchar();
c == ' ' ? sf("%lf",&speed):printf("%s %.2lf km\n",time,dis);
prev = current;
}
return 0;
}
#define dbug(x) cout << '>' << #x << ':' << x << endl
#define dbg(x) cout << '>' << #x << ':' << x << " "
#define pline cout << "_________________________" << endl
#define mem(x, v) memset(x, v, sizeof(x))
#define eef else if
#define sf scanf
#define pf printf
#define i64 long long
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define lla(x) x.rbegin(), x.rend()
#define SORT(c) sort(all(c))
#define ssort(v) stable_sort(v.begin(), v.end())
#define sz(v) (int)(v).size()
#define IT iterator
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define contains(T, x) (T.find(x) != T.end())
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(max(a,max(b,c)),d)
#define Reverse(x) reverse(x.begin(),x.end())
#define loop(i,s,e) for(__typeof(s) i=(s);i<=(e);i++)
#define pool(i,e,s) for(__typeof(e) i=(e);i>=(s);i--)
#define FORIT(i, m) for (__typeof((m).begin()) i=(m).begin(); i!=(m).end(); ++i)
#define newl '\n'
// 12345678901234567890
#define MAX 1e5
#define Fast ios_base::sync_with_stdio(0)
using namespace std;
int main(){
//Fast;
char time[20]="";
double speed = 0 , current = 0 , prev = 0 , dis;
while(sf("%s",time)!=EOF){
double h , m , s;
char c;
sscanf(time,"%lf:%lf:%lf",&h,&m,&s);
current = (h*3600)+(m*60)+s;
dis += (current - prev)*(speed/3600.0);
c = getchar();
c == ' ' ? sf("%lf",&speed):printf("%s %.2lf km\n",time,dis);
prev = current;
}
return 0;
}
No comments:
Post a Comment