4号测试点是什么数据?
查看原帖
4号测试点是什么数据?
897476
ShinlorLi楼主2022/11/27 00:52

JAVA选手,使用format格式化输出

Double f = sc.nextDouble();
System.out.printf("%.12f",f);

4号测试点报WA:Wrong Answer.wrong answer On line 1 column 14, read 4, expected 3.

DecimalFormat()方法,AK。

DecimalFormat myFormat = new DecimalFormat("0.000000000000");
System.out.println(myFormat.format(f));

查了很久都没有查到这两种保留小数位数方法的区别,也测试过正数、负数、超长数、科学计数法浮点数,都没有找到区别……
想请求大神们的帮助!

2022/11/27 00:52
加载中...