头像
杨权钊
发布于 2019-09-02 13:14
+ 关注

坑点

题目有坑,保留三位小数,必须要直接剪切或者增加补零,不能使用四舍五入的函数,不然只有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));

	}

}

全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐