1
//
HLOJ_1301 just for play Accepted
2
3 #include < iostream >
4 #include < cmath >
5 using namespace std ;
6
7 int ina, inb, inc ;
8
9 int main()
10 {
11 int cnt = 0 ;
12 while ( cin >> ina >> inb >> inc )
13 {
14 if ( 0 == ina && 0 == inb && 0 == inc ) break ;
15
16 printf( " Triangle #%d\n " , ++ cnt ) ;
17
18 double result = 0 ;
19
20 if ( - 1 == ina )
21 {
22 if ( inc <= inb )
23 {
24 printf( " Impossible.\n " ) ;
25 }
26 else
27 {
28 result = sqrt( 1.0 * inc * inc - inb * inb ) ;
29 printf( " a = %0.3lf\n " , result ) ;
30 }
31 }
32 else if ( - 1 == inb )
33 {
34 if ( inc <= ina )
35 {
36 printf( " Impossible.\n " ) ;
37 }
38 else
39 {
40 result = sqrt( 1.0 * inc * inc - ina * ina ) ;
41 printf( " b = %0.3lf\n " , result ) ;
42 }
43 }
44 else
45 {
46 result = sqrt( 1.0 * ina * ina + inb * inb ) ;
47 printf( " c = %0.3lf\n " , result ) ;
48 }
49
50 printf( " \n " ) ;
51 }
52
53 return 0 ;
54 }
55 // c = 5.000
2
3 #include < iostream >
4 #include < cmath >
5 using namespace std ;
6
7 int ina, inb, inc ;
8
9 int main()
10 {
11 int cnt = 0 ;
12 while ( cin >> ina >> inb >> inc )
13 {
14 if ( 0 == ina && 0 == inb && 0 == inc ) break ;
15
16 printf( " Triangle #%d\n " , ++ cnt ) ;
17
18 double result = 0 ;
19
20 if ( - 1 == ina )
21 {
22 if ( inc <= inb )
23 {
24 printf( " Impossible.\n " ) ;
25 }
26 else
27 {
28 result = sqrt( 1.0 * inc * inc - inb * inb ) ;
29 printf( " a = %0.3lf\n " , result ) ;
30 }
31 }
32 else if ( - 1 == inb )
33 {
34 if ( inc <= ina )
35 {
36 printf( " Impossible.\n " ) ;
37 }
38 else
39 {
40 result = sqrt( 1.0 * inc * inc - ina * ina ) ;
41 printf( " b = %0.3lf\n " , result ) ;
42 }
43 }
44 else
45 {
46 result = sqrt( 1.0 * ina * ina + inb * inb ) ;
47 printf( " c = %0.3lf\n " , result ) ;
48 }
49
50 printf( " \n " ) ;
51 }
52
53 return 0 ;
54 }
55 // c = 5.000