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