Submitted 3 years 7 months 1 day ago
Sat Apr 24 16:18:21 CST 2021
Judger: judger1
Dataset Version: v0
0 ms /
0 KB
Final
0
Problem: fun21.calc
Language: Java 8
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;
public class Calc {
static Scanner scanner=new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
int d,a;
MathContext mc=new MathContext(10);
d=scanner.nextInt();
a=scanner.nextInt();
BigDecimal ra=BigDecimal.valueOf(d*2),rb=BigDecimal.valueOf(a);
BigDecimal res=ra.divide(rb,mc);
System.out.println(res.sqrt(mc).toString());
}
}
Compilation Error: Main.java:5: error: class Calc is public, should be declared in a file named Calc.java public class Calc { ^ Main.java:15: error: cannot find symbol System.out.println(res.sqrt(mc).toString()); ^ symbol: method sqrt(MathContext) location: variable res of type BigDecimal 2 errors