코드비교

Old VersionNew Version
1import java.util.Scanner; 1import java.util.*;
2public class Main { 2public class Main { 
3public static void main(String[] args) { 3public static void main(String[] args) { 
4Scanner input = new Scanner(System.in); 4Scanner scanner = new Scanner(System.in);
5double area; 5int n=scanner.nextInt();
6int n = input.nextInt(); 6double s=scanner.nextDouble();
7double s = input.nextDouble(); 7double A;
8area = n * Math.pow(s, 2)/(4 * Math.tan(Math.PI/ n)); 8A=(n*Math.pow(s,2)/(4*Math.tan(Math.PI/n)));
9System.out.printf("%.2f", (int)(area * 100)/100.00); 9int a=(int)(A*100);
   10A = (double)a/100;
   11System.out.printf("%.2f",A);
10} 12} 
11} 13} 
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double area;
int n = input.nextInt();
double s = input.nextDouble();
area = n * Math.pow(s, 2)/(4 * Math.tan(Math.PI/ n));
System.out.printf("%.2f", (int)(area * 100)/100.00);
}
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n=scanner.nextInt();
double s=scanner.nextDouble();
double A;
A=(n*Math.pow(s,2)/(4*Math.tan(Math.PI/n)));
int a=(int)(A*100);
A = (double)a/100;
System.out.printf("%.2f",A);
}
}