#include /* CHAOS :) */ int main(int argc, char ** argv) { FILE * f = fopen("average.in", "r"); int i; int sects; float dist, av, tsec; double buf, wuff; int team; char string[100]; int hours, min, sec, bla= 0; int totmin, totsec=0; fscanf(f, "%d %f", §s, &dist); bla: while(fscanf(f, "%d", &team) != EOF) { tsec=0; for(i=0; i 0) { tsec = tsec + sec + 60*min + 3600*hours; } else { fscanf(f, "%s\n", string); printf("%3d: -\n", team); goto bla; } } /*Berechne */ av = tsec /dist; buf = (av/60); bla = ((int)av) % 60; totmin = (int)buf; totsec = bla; wuff = av - (totmin*60+totsec); if((wuff > 0.5) && (totsec != 59)){ totsec++; } if((wuff > 0.5) && (totsec == 59)){ totsec = 0; totmin++; } if(totsec ==0) { printf("%3d: %d:00\n", team, totmin); } else{ printf("%3d: %d:%2d\n", team, totmin, totsec); } } return(0); }