题目: AC代码 import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String a = scanner.next(); String b = scanner.next(); int n = scanner.nextInt(); BigDecimal num1 = new BigDecimal(a); BigDecimal num2 = new BigDecimal(b); BigDecimal num3 = num1.divide(num2,n + 2, BigDecimal.ROUND_DOWN); String res = num3.toString(); System.out.println(res.substring(res.length() - 3)); } } 收获: 关于大数类中的舍入字段:是根据设定的scale小数位数的后一位数字进行舍入