Created
December 22, 2015 02:09
-
-
Save peter279k/abde378bd50fc0ce7c51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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