新手菜鸟求解,杭电ACM输出问题。
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2002
Problem Description
根据输入的半径值,计算球的体积。  
Input
输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。  
Output
输出对应的球的体积,对于每组输入数据,输出一行,计算结果保留三位小数。  
Sample Input
1
1.5  
Sample Output
4.189
14.137
Hint
#define PI 3.1415927
代码:
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		double r;
		double s;
		final double PI=3.1415927;
		while (cin.hasNext()) {
			r = cin.nextDouble();
			s = 4*PI*r*r*r/3;
			System.out.printf("%.3f\n",s);
		}
	}
}
OJ结果:Presentation Error
求大侠帮忙看下,谢谢。
------解决方案--------------------你输出的最后一组结果多了一个换行符
------解决方案--------------------while (cin.hasNext())  
改成
while (true)  
试下