speed/speed_vanb.java
1
2 import java.io.*;
3 import java.util.*;
4 import java.awt.geom.*;
5
6
7
8
9
10
11 public class speed_vanb
12 {
13 public Scanner sc;
14 public PrintStream ps;
15
16
17
18
19
20 public void doit() throws Exception
21 {
22 sc = new Scanner( new File( "speed.judge" ) );
23 ps = new PrintStream( new FileOutputStream( "speed.solution" ) );
24
25 for(;;)
26 {
27 int distance = sc.nextInt();
28 if( distance==0 ) break;
29
30 double s1 = sc.nextDouble();
31 double s2 = sc.nextDouble();
32
33
34
35
36 double t1 = distance * 60.0 * 60.0 / s1;
37 double t2 = distance * 60.0 * 60.0 / s2;
38
39
40 int dt = (int)Math.round( t1-t2 );
41
42
43 int seconds = dt % 60;
44 int minutes = (dt / 60) % 60;
45 int hours = dt / 60 / 60;
46
47 ps.printf( "%d:%02d:%02d", hours, minutes, seconds );
48 ps.println();
49 }
50 }
51
52
53
54
55 public static void main( String[] args ) throws Exception
56 {
57 new speed_vanb().doit();
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 }
76 }