Author : Jisan
Programming language : Java
Difficulty : Easy
Status: Accepted
Problem number : UVA-579
http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=520
Code:
import java.util.*;
public class Uva_579 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while(s.hasNext()){
String tomato=s.nextLine();
StringTokenizer jis=new StringTokenizer(tomato,":");
double hour=Integer.parseInt(jis.nextToken());
double mins=Integer.parseInt(jis.nextToken());
if(hour==0 && mins==0){
break;
}
double jisan=Math.abs(.5*(60*hour-11*mins));
if(jisan>180){
jisan=360-jisan;
}
System.out.printf("%.3f\n", jisan);
}
}
}
Programming language : Java
Difficulty : Easy
Status: Accepted
Problem number : UVA-579
http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=520
Code:
import java.util.*;
public class Uva_579 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while(s.hasNext()){
String tomato=s.nextLine();
StringTokenizer jis=new StringTokenizer(tomato,":");
double hour=Integer.parseInt(jis.nextToken());
double mins=Integer.parseInt(jis.nextToken());
if(hour==0 && mins==0){
break;
}
double jisan=Math.abs(.5*(60*hour-11*mins));
if(jisan>180){
jisan=360-jisan;
}
System.out.printf("%.3f\n", jisan);
}
}
}
No comments:
Post a Comment