hdu 1036 水题
这种水题都PE了好几次,真是不应该啊!
/*
* hdu1036/linux.cpp
* Created on: 2011-8-31
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
void work();
int main() {
#ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
#endif
work();
return 0;
}
void work() {
int N, t, time, th, tm, ts;
double d;
bool flag;
scanf("%d %lf", &N, &d);
while (scanf("%d", &t) == 1) {
time = 0;
flag = false;
for (int i = 0; i < N; i++) {
if (scanf(" %d:%d:%d", &th, &tm, &ts) == 3) {
time += ts;
time += tm * 60;
time += th * 3600;
} else {
scanf(":--:--");
flag = true;
}
}
if (flag) {
printf("%3d: -\n", t);
continue;
}
time = (time / d + 0.5);
ts = time % 60;
tm = time / 60;
printf("%3d: %d:%02d min/km\n", t, tm, ts);
}
}