坑点
题目有坑,保留三位小数,必须要直接剪切或者增加补零,不能使用四舍五入的函数,不然只有90%的通过率
import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.000"); int a=sc.nextInt(); int b=sc.nextInt(); System.out.print(df.format(a/(double)b)); } }