1.

/**
* Angewandte Mathematik, SS11
* Problem: 579 ClockHands
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=520
*
* @author Georg Weber, Daniel Brielbeck
* @version 1.0, 03/05/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 1.804
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input;
while ((input = reader.readLine()) != null) {
if (input.equals("00:00")) break;
String[] splitted=input.split(":");
int h=Integer.valueOf(splitted[0]);
int m=Integer.valueOf(splitted[1]);
if(h==0&&m==0)break;
if (h==0)h=12;
double output = Math.abs(0.5*(60*h-11*m));
if (output>=180) output=360-output;
System.out.println(output+"00");
}
}

}


------------------------------------------------------------------

1.

/**
 *
 * Problem #579 - Clock Hands
 * http://uva.onlinejudge.org/external/5/579.pdf

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted

 * Runtime: 2.528
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Locale;


public class Main {


    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        BufferedReader console = new BufferedReader(new InputStreamReader(System.in));

       
        for(String line = console.readLine(); line != null; line = console.readLine()) {
            if (line.equals("0:00")){
                    break;
            }       
            String[] splittArray = line.split(":");

            int h= Integer.parseInt(splittArray[0]);
            int m = Integer.parseInt(splittArray[1]);
           
            double result = (h*30+(m/60.0)*30)-m*6;
            if (result<0){
                result=360+result;

            }
            if (result> 180){
                result=360-result;
            }

            DecimalFormat format =
                  (DecimalFormat)DecimalFormat.getInstance(Locale.US );

                format.applyPattern( "#,###0.000" );
           
            System.out.println(format.format(new Double(result)));
            }
        }

    }


2.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 579 Clock Hands
*
* @author Robert Reichart
*
* Status : Accepted
* Runtime: 2.164
*/

import java.io.*;
import java.text.*;
class Main{
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void main(String... args){
try{
String line = readLine();
while(!line.equals("0:00")){
//System.out.println(line);
String[] hm = line.split(":");
int h=Integer.parseInt(hm[0]);
int m=Integer.parseInt(hm[1]);

double HAnglePM = 0.5;

double HAnglePH = 30;

double MAnglePM = 6;

double MAngle=m*MAnglePM;
//System.out.println("MAngle= " + MAngle);
double HAngle=h*HAnglePH+m*HAnglePM;
//System.out.println("HAngle= " + MAngle);
double angle=Math.abs(HAngle-MAngle);
if(angle>180){angle=360-angle;}
DecimalFormat df = new DecimalFormat ( "0.000" );
//System.out.println("angle=" + angle);

System.out.println(df.format(angle));
line=readLine();
}
}catch(Exception ex){}
}

static String readLine(){
try{
String line=in.readLine();
while(line.equals("")){
line=in.readLine();
}
return line;
}catch(Exception ex){return null;}
}
}