Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created December 22, 2015 02:09
Show Gist options
  • Save peter279k/abde378bd50fc0ce7c51 to your computer and use it in GitHub Desktop.
Save peter279k/abde378bd50fc0ce7c51 to your computer and use it in GitHub Desktop.
import java.util.*;
public class main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while(input.hasNext()) {
double s = input.nextDouble();
double a = input.nextDouble();
String deg_min = input.next();
if(deg_min.equals("min")) {
a /= 60;
}
if(a > 180)
a = 360 - a;
double ang = a * Math.acos(-1.0)/180.0;
double arc = 2.0 * (s+6440.0) * Math.sin(ang/2.0);
double cho = ang * (s+6440.0);
System.out.printf("%.6f %.6f\r\n", cho, arc);
/*
double ang = a*acos(-1.0)/180.0;
double arc = 2.0*(s+6440.0)*sin(ang/2.0);
double cho = ang*(s+6440.0);
*/
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment